According to WebMD, a fetus excretes waste through the umbilical cord while it is in the womb. On rare occasions, a fetus may excrete waste while still inside the uterus, as stated by the National Institute of Health. If this happens, the baby runs the risk of meconium aspiration syndrome.
When a fetus is in the womb, it is surrounded by a placenta and the umbilical cord is responsible for removing waste, as described by WebMD. The mother's blood and the blood of the fetus flow thorough the placenta, both in separate blood vessels. Nutrients and oxygen move from the mother's blood to the fetus' blood to nourish the baby. The blood picks up waste products from the fetus and these are removed via the umbilical cord.
In most cases, the baby does not excrete waste directly into the womb. There may be cases, according to the National Institute of Health, in which this happens. It normally does not occur until near the time of delivery, and usually only when the baby is under stress which causes him or her to excrete while still in the womb. Some things that may cause this undue stress might be long labor, difficult delivery, high blood pressure in the mother or decreased oxygen to the infant while in utero. If the baby excretes waste while still in the womb, he or she runs the risk of aspirating the waste. This can cause breathing problems, as the baby's airway may become blocked.