Male babies can have erections while in the womb

Surprising as it may seem, fetuses are known to have erections while in the womb. This is medically referred to as fetal penile tumescence.

During pregnancy, ultrasound scans are usually carried out to monitor the developing fetus and sex determination. Occasionally during these scans, male fetuses are seen to have erections. 

A study in Japan of 50 male fetuses at 36-39 weeks gestation revealed 41.7% had erections in the given observation period with each erection lasting from 5 to 17 minutes.

Erections in male fetuses is not a sign of an abnormality but is a normal in-utero physiological activity.