All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
One of the principal objectives behind legislating marriage in Islam is to produce offspring and, for this reason, the Islamic Shariah encouraged marriage and prohibited castration and celibacy. It also rendered the preservation of offspring one of the five essential necessities of life. Therefore, it is prohibited for the spouses to use any method that prevents pregnancy altogether unless there is a valid necessity. Please refer to fatwas 86967 and 344434.
We shall cite some statements of the scholars in this regard:
The Maaliki scholar An-Nafraawi said, "It is impermissible for the woman to use a medication to prevent pregnancy permanently, just as it is impermissible for the man to use what reduces the chances of pregnancy or makes him unable to have children altogether."
The Shaafiʻi scholar Ibn Hajar Al-Haytami said, "It is prohibited to use what prevents pregnancy permanently, as stated by many scholars; and this is the stronger view in this regard." [At-Tuhfah]
The Hanbali scholar Ar-Ruhaybaani said, "It is prohibited to drink what prevents pregnancy permanently." [Mataalib Uli An-Nuha]
Claiming that having children makes the marriage less happy contradicts the Shariah and reality and is an indulgence in mere illusions. Allah, the Exalted, says (what means): {And Allah has made for you from yourselves mates and has made for you from your mates sons and grandchildren and has provided for you from the good things. Then in falsehood do they believe and in the favor of Allah they disbelieve?} [Quran 16:72] Allah, the Exalted, described children as part of the adornment of life; He says (what means): {Wealth and children are (but) adornment of the worldly life. But the enduring good deeds are better to your Lord for reward and better for (one's) hope.} [Quran 18:46]
A person who denies himself the blessing of having children is missing out on the great benefits that it yields in the worldly life and the Hereafter. Abu Hurayrah narrated that the Prophet, sallallaahu ‘alayhi wa sallam, said, "When a man dies, his deeds come to an end, except for three: a continuous charity, knowledge by which people derive benefit, and a pious child who prays for him." [Muslim]
It should be noted that ʻAzl (coitus interruptus) is allowed provided that it is done with the wife's consent, because it may deprive her of full sexual enjoyment or of having children while she is entitled to both. It is impermissible to deprive her of these two rights except with her consent. Needless to say, ʻAzl can never prevent a pregnancy predetermined by Allah, the Exalted. Abu Saʻeed narrated that the Prophet, sallallaahu ‘alayhi wa sallam, said to the Companions who asked him about the permissibility of practicing ʻAzl with their captive slave girls, "It will not make a difference if you do not do it. There is no soul that is destined to exist, up to the Day of Resurrection, but that he will definitely come into existence." [Al-Bukhaari and Muslim]
Allah knows best.