Does she pass stool in the day? And by any chance, does she also have pain while passing stool? It could be a case of constipation, or even, in some cases, lactose intolerance, which often starts off like this.
Make sure she has plenty of water and fresh fluids, such as juices, so that her digestive system works smoothly and the stools don't turn hard. Try and get her on a morning schedule so that she wakes up less at night. Also, if there is no improvement, speak to a doctor, as certain tests are done to check for lactose intolerance. All the best.