Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
There are 2 ways of preventing pregnancy. One is permanent, which is by performing a hysterectomy for the woman or castrating the man, or by him taking a medicine which will prevent the ability of fertilization. The ruling about this is that it is forbidden, because it is considered as changing of the creation of Allah and a termination of human reproduction.
Al Qurtubi said commenting on the verse: and indeed I will order them to change the nature created by Allâh. [4:119] 'that it is forbidden to extinguish human reproduction as it is mutilating and changing the creation of Allah.'
Ibn Masoud (Radiya Allahu Anhu) also said, "We in a battle with the Prophet (Sallallahu Alaihi wa Sallam) and did not have wives. So we asked ‘why don’t we get castrated? The Prophet (Sallallahu Alaihi wa Sallam) forbid us to do so." Agreed upon [Narrated by Bukhari and Muslim]
Castration is forbidden because it is a way of permanently preventing the ability of fertilization in a man. Also permanently preventing pregnancy in a woman is forbidden, because both methods prevent pregnancy-taking place at its source. It is known that among the objectives of Shariah is to protect the human reproduction.
Permanently preventing pregnancy and using contraceptives and other medical measures to terminate the ability of reproduction is certainly demolishing that great objective. That’s why it is forbidden.
The second way of preventing pregnancy is by temporary prevention. This is a matter that needs to be looked into. If it is for a real necessity, for instance if the woman does not give a normal birth but is subjected to a caesarean section, or delaying the birth (meaning separating between one birth and another by a given period of time) for an interest agreed between the husband and wife, for example to have more time to educate the children; in this case there is no harm in preventing it or delaying it according to given a benefit.
The evidence of this being permissible is in the Hadith of Jabir (Radiya Allahu Anhu) who said, "We used to separate ourselves from our wives while the Qur'an was being revealed" - meaning at the time of the Prophet (Sallallahu Alaihi wa Sallam).
If this fact is Haram, the Prophet (Sallallahu Alaihi wa Sallam) would most certainly have forbidden them from doing so. A number of companions (Radiya Allahu Anhum) also narrated that this method was permissible.
Bearing in mind that it is totally Haram to believe that the provision would not be sufficient because of having children. Allah, The Most High, has created the creation and undertaken their provision.
Allah Says (interpretation of meaning): {And kill not your children for fear of poverty. We provide for them and for you….}[17:31].
Allah knows best.