It is believed that the fetus breathes in amniotic fluid or drinks it. When this happens and the amniotic fluid enters and exists the fetus lungs then the diaphragm contracts and hiccups results.
actually they have a lot of fun in there. they sleep and when they arent they kick and stretch its a miracle it really is and they also grow and go through different stages