Firemen who rushed to the student dormitory in the city of Linyi in eastern China's Shandong Province were amazed to find the child wedged in the pipe and clearly still alive from the noise she was making, and realised it was a race against time to free her.
Fire Brigade spokesman Tao Fang said: "It was impossible to get the baby out from above.
"She had fallen into the toilet and gone down the pipes were she had got stuck between the third and fourth floors.
"We used an angle grinder to break open the pipeline on the third floor and we could then push the child up to colleagues on the fourth floor where she was handed to medics who were waiting to take her to hospital."
Police say they are waiting to question her before deciding what she might be charged with.
The shocking story caused heated debate on Chinese social media sites with many lamenting lack of decent values among the country's youth and shock at the way she had simply abandoned the baby in the toilet.
One user on China's popular social media site Weibo, WangLo34, said: "I find the image of a young woman giving birth in the toilet, cleaning herself up and then going back to her room to carry on studying a particularly worrying one and a sign of the sort of throwaway society that we live in now days."