The old way

Until fairly recently, a prenatal DNA test was an invasive and somewhat dangerous procedure.

A doctor would have to insert a needle through the abdominal wall and into the womb in order to collect a sample of amniotic fluid along with a tissue sample from the placenta.

This kind of test would carry a small risk of miscarriage and other complications to the pregnancy, and as such doctors didn't like doing it unless there was a genuine medial reason. Simply wanting to know the identity of the baby's father was not a strong enough justification.