Below is a quote from an answer given to a similar question:
"What has confused the questioner is the fact that doctors are able to know the gender of the foetus via x-rays and ultrasound scans, but we should note that this knowledge is vague and incomplete. They may make mistakes, as has happened on numerous occasions. Moreover, they can only perform these scans etc. after a certain number of weeks of pregnancy have passed, and not before. Even if they know whether the foetus is male or female, they do not know whether it will be miscarried or carried to term, whether it will be born alive or dead. They do not know the precise length of time that it will stay in its mother’s womb. They have nothing but conjecture and uncertainties. They do not know how long this person will live, how he will behave or what his provision will be, or whether he will be of the people of Paradise or the people of Hell. Knowledge of what is in the wombs is not merely a matter of knowing whether the foetus is male or female; it is broader than that, and no-one can know it all except Allaah, as He says (Interpretation of the meaning):
"Allaah knows what every female bears, and by how much the wombs fall short or exceed. Everything with Him is in (due) proportion." [ar-Ra’d 13:8]"
Comments
In addition to x-rays and ultrasound, many women are now having cell-free foetal DNA tests which screen for genetic disorders such as Trisomy 18 and Downs Syndrome. These tests also determine gender. Cell-free DNA is around 95% correct. With regards to ultrasound, accuracy does depend on who's doing it, but done by a skilled person, accuracy is above 90%.
So...pretty freakin far from "vague".