The ancient Egyptians didn't have ultrasound but they still figured out how to determine the gender of a baby - sort of.

By urinating on wheat and barley seeds. If barley grew, it meant that it was a male child. If wheat grew, it was a female child. If neither grew, it meant that she wasn’t pregnant.

Guessing is right 50% of the time, right? Nonetheless, in modern testing the barley pissing had a 70% success rate.

Credit and link: OMG facts

A Timeline of Pregnancy Testing - History.NIH.Gov, yes, a government website is running, one of the few the administration did not shut down out of spite.

Source: Ancient Egyptians had a pregnancy test that predicted the sex of the baby 70% of the time! - OMG facts