We have discussed the ruling on misyaar marriage [Misyaar marriage is where a man does a shar‘i marriage contract with a woman, meeting the conditions of marriage, but the woman gives up some of her rights such as accommodation, maintenance or the husband’s staying overnight with her] in the answer to question no. 85369, where we stated that it is a valid marriage if it fulfils the conditions and essential parts of marriage and is free of any impediments, but it is not the best option because of what it leads to of harm and negative consequences, that we discussed there.
With regard to the couple agreeing not to have children, this is either for a specific time period or it may be on a permanent basis.
In the first case, which is where they agree not to have children for a temporary period, there is nothing wrong with this. This has been discussed previously in the answer to question no. 130395.
But if the agreement between the spouses is never to have children at all, then this is a matter concerning which the scholars differed. Some say that it is permissible and some say that it is haraam and is not allowed. If this is made a condition in the marriage contract then some scholars regard the contract as invalid and some think that it is valid but the condition is invalid, and this is the correct view. Taking measures to prevent having children at all is contrary to Islam, which encourages people to have children multiply, and regards that as one of the aims of marriage. However that condition does not render the marriage contract invalid; rather it is an invalid condition. If it is made one of the conditions of the marriage contract, the contract is valid but this condition is invalid and it is not permissible for either party to adhere to it.
Sharaf ad-Deen al-Hajjaawi (may Allah have mercy on him) said:
If both or one of them stipulates a condition that there be an option to cancel the marriage contract or the mahr, or that there is to be no intimacy, or that he should bring the dowry at a certain time otherwise there is no marriage, or it is stipulated that there is to be no dowry or maintenance, or that this wife is to have less of a share of the husband’s time than her co-wife, or a greater share, or he stipulates that he will engage in coitus interruptus with her… The condition is invalid but the marriage contract remains valid.
Al-Iqnaa‘ fi Fiqh al-Imam Ahmad ibn Hanbal, 3/193
And Allah knows best.