Amniotic sac
After the fetus is about four months old, when the kidneys start to work, the amniotic fluid serves another important purpose.  The fetus swallows amniotic fluid.  This fluid passes through the fetus's digestive system and urinary system and gets urinated out into the amniotic fluid.  This helps the fetus "practice" swallowing, digesting, and urinating before being born.