It should be noted that the layer of soft, fine hair that starts growing on the fetus at the 30th week of pregnancy is not hair as we know it, but lanugo. It starts to fall of prior to delivery, when actual hair starts to grow, beginning with the eyebrows and eyelashes.
Lanugo starts to cover the body of babies in the womb as a way to regulate their own body temperature, given that they still do not have enough fat. When lanugo falls off, babies literally eat it and expel it with their first "poop", which is known as meconium.
Suggested for you: Pregnancy Stages by Month – Fetal Development with Pictures.