There are four main factors that prevent the baby from inhaling water at the time of birth:
1. Prostaglandin E2 levels from the placenta which cause a slowing down or stopping of the fetal breathing movements. When the baby is born and the Prostaglandin level is still high, the baby's muscles for breathing simply don't work, thus engaging the first inhibitory response.
2. Babies are born experiencing mild hypoxia or lack of oxygen. Hypoxia causes apnea and swallowing, not breathing or gasping.
3. Water is a hypotonic solution and lung fluids present in the fetus are hypertonic. So, even if water were to travel in past the larynx, they could not pass into the lungs based on the fact that hypertonic solutions are denser and prevent hypotonic solutions from merging or coming into their presence.
4. The last important inhibitory factor is the Dive Reflex and revolves around the larynx. The larynx is covered all over with chemoreceptors or taste buds. The larynx has five times as many taste buds as the whole surface of the tongue. So, when a solution hits the back of the throat, passing the larynx, the taste buds interprets what substance it is and the glottis automatically closes and the solution is then swallowed, not inhaled.