Does this not contradict medical science? To answer this we should look at the verses that relate to this matter “and He Who knows what is in the wombs. Nor does any one know what it is that he will earn on the morrow: Nor does any one know in what land he is to die” (Quran 31:34)
“Allah doth know what every female (womb) doth bear, by how much the wombs fall short (of their time or number) or do exceed. Every single thing is before His sight, in (due) proportion.” (Quran 13:8)
If one reads the Arabic text of this verse, they will find that there is no Arabic word that corresponds to the English word ‘sex’ or ‘gender’. The Quran mentions only the knowledge of “what” is in the womb. Many have misunderstood this to mean the sex of the child in the womb, which is incorrect.
Today, science has indeed advanced, and we can easily determine the sex of the child in the womb of a pregnant mother using ultrasound scanning. Therefore, the above verse refers to every aspect of the fetus’ present and future existence. What will be the child’s nature? Will the child be a blessing or a curse to the parents? What will happen to him or her throughout life? Will he or she do good or evil? How long will he or she live? Will he or she end up in Paradise or in Hell? Allah alone knows all of this… no scientist in the world, no matter how advanced the technology, will ever be able to determine these things about a child in the mother’s womb.