Bear in mind that children—males and females—are Allah’s gifts. Therefore, a Muslim should accept Allah’s gifts with pleasure and gratitude.
Determining the sex of a fetus before conception does not go against religious morals, nor does it infringe upon faith, for it is nothing other than utilizing the means given to us by Allah. What falls beyond that utilization is up to the Creator of that means. The supreme will is His, Most Sublime is He. Nor does the procedure amount to an alteration of Allah’s creation; for the sperm is still a sperm and the ovum an ovum, and the only intervention is the fertilization of the ovum with a particular type of sperm, while both of them are created by Allah.
It is known that there are two kinds of sex chromosomes, X and Y. A female has two X chromosomes, while a male has one X and one Y chromosome. When a sperm containing an X chromosome fertilizes an egg, the resulting offspring will be female. When a sperm containing a Y chromosome fertilizes an egg, the offspring is male.
Researches have been conducted in order to discover the differences between the sperms bearing the X chromosome and those bearing the Y chromosome. It has been proved that they differ in their mass, speed, electrical effect, ability to penetrate into and across a viscid medium, and their degree of activity according to the chemical interaction of the surrounding environment. Such differences have been used to make one of them precede the other in fertilizing the egg, and thus deciding the sex of the fetus.
However, it should be clear that the Islamic legal viewpoint is that sex selection is unlawful when it is practiced at a national level. On an individual basis, there is nothing legally wrong with an attempt to fulfill the wish of a married couple to have a boy or a girl through available medical means.
Dr. Sano Koutoub Moustapha, professor of fiqh and its principles, International Islamic University, Malaysia, states: Certainly, the final and definitive determination of the gender of a child is in the hands of Allah; thus, He is the Creator. In this regard, one should believe that scientific researches would never contradict the will of Allah.
Having said that, I shall point out that there is no harm in looking for ways and means that might help in having a female or a male child, as far as the means are lawful and permissible. In other words, one should not use any unlawful means that lead to the abortion of a child because of his or her gender.