Praise be to Allah.
The first hadeeth was narrated by al-Bukhaari (5066) and Muslim (1400) from Ibn Mas‘ood, who said: We were with the Prophet (blessings and peace of Allah be upon him), young men who had nothing of wealth. The Messenger of Allah (blessings and peace of Allah be upon him) said to us: “O young men, whoever among you can afford it, let him get married, for it is more effective in lowering the gaze and guarding one’s chastity. And whoever cannot afford it should fast, for it will be a shield for him.”
The second hadeeth was narrated by al-Bukhaari (5030) and Muslim (1425) from Sahl ibn Sa‘d: A woman came to the Messenger of Allah (blessings and peace of Allah be upon him) and said: O Messenger of Allah (blessings and peace of Allah be upon him), I have come to give myself to you (in marriage). The Messenger of Allah (blessings and peace of Allah be upon him) looked her up and down, then the Messenger of Allah (blessings and peace of Allah be upon him) lowered his head. When the woman saw that he had not made any decision about her, she sat down. A man among his companions stood up and said: O Messenger of Allah, if you have no need of her then marry her to me. He said: “Do you have anything?” He said: No, by Allah, O Messenger of Allah. He said: “Go to your family and see if you can find something.” So he went, then he came back and said: No, by Allah, O Messenger of Allah, not even a ring of iron, only this izaar (lower garment) of mine – Sahl said: he did not have a rida’ (upper garment) – and she may have half of it. The Messenger of Allah (blessings and peace of Allah be upon him) said: “What will she do with your izaar? If you wear it she will not have anything of it and if she wears it you will not have anything of it. The man sat down, and after he had sat for a long time, he got up (to leave). The Messenger of Allah (blessings and peace of Allah be upon him) saw him turning away, and he ordered that he be called to him. When he came, he said: “What do you know of the Qur’aan?” He said: I know Soorah such and such and Soorah such and such – and he listed them. He said: “Do you recite them by heart?” He said: Yes. He said: “Go. You have been given her (in marriage) for what you know of the Qur’an.”
These two hadeeths do not contradict one another, praise be to Allah; rather each of them speaks of a specific situation. The hadeeth of Ibn Mas‘ood addresses young men and those who want to get married in general terms, to highlight the fact that marriage requires one to have sufficient resources so that the husband will be able to do what has been enjoined upon him of spending on his wife’s maintenance and providing her with clothing and accommodation.
The phrase translated here as “afford it” refers to the costs of marriage; the Lawgiver wanted to highlight this principle, which is that marriage is not merely a contract or fulfilling one’s desire in a permissible manner; rather it is responsibilities and duties, and it is the man who is responsible for his wife’s maintenance.
This also indicates that in the case of one who is unable to get married, it is prescribed for him to focus on fasting, because it weakens desire and reduces the influence of the Shaytaan, so it is one of the means of attaining chastity and lowering the gaze.
Majmoo‘ Fataawa Ibn Baaz (3/329)
The words of the Prophet (blessings and peace of Allah be upon him), “whoever among you can afford it, let him get married” also indicate that what is prescribed for the one who is able to afford the costs and responsibilities of marriage is to hasten to get married.
The scholars of the Standing Committee said: Hastening to get married, for a younger man, is the Sunnah for whoever can afford the expenses of marriage and fulfil the duties of marriage.”
End quote from Fataawa al-Lajnah ad-Daa’imah (18/6)
See also the answer to question no. 9262.
With regard to the second hadeeth, it refers to a specific case, and the issue is that of a poor person who wanted to get married and keep himself chaste, so the Prophet (blessings and peace of Allah be upon him) married him to that woman who came to offer herself in marriage to the Prophet (blessings and peace of Allah be upon him). This indicates that poverty in and of itself is not an impediment to marriage if the husband is religiously committed and believes sincerely in his Lord, and the woman is likewise. Moreover, Allah, may He be exalted, says (interpretation of the meaning): “And marry those among you who are single (i.e. a man who has no wife and the woman who has no husband) and (also marry) the Salihoon (pious, fit and capable ones) of your (male) slaves and maid-servants (female slaves). If they be poor, Allah will enrich them out of His Bounty. And Allah is All-Sufficent for His creatures needs, All-Knowing (about the state of the people)” [an-Noor 24:32]. If a person sincerely puts his trust in Allah, wants to keep himself chaste, and seeks that which is with Allah of bounty, there is the hope that Allah will help such a person and grant him provision from His bounty, as at-Tirmidhi (1655) narrated, in a report which he classed as hasan, from Abu Hurayrah, who said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “There are three whom Allah is bound to help: the mujaahid who strives (in jihad) for the sake of Allah, the mukaatib (a slave who has made a contract of manumission with his master) who wants to pay off his manumission, and a man who gets married, seeking to remain chaste.”. It was classed as hasan by al-Albaani in Saheeh at-Tirmidhi.
Imam al-Bukhaari (may Allah have mercy on him) included this hadeeth in a chapter entitled: “Chapter on marriage of one who is in financial difficulty, because Allah, may He be exalted, says (interpretation of the meaning): “If they be poor, Allah will enrich them out of His Bounty” [an-Noor 24:32]. Al-Haafiz (may Allah have mercy on him) said: “The words ‘because Allah, may He be exalted, says (interpretation of the meaning): ‘If they be poor, Allah will enrich them out of His Bounty’ [an-Noor 24:32]” explain the reason why al-Bukhaari put this as the title of this chapter; what is meant is that current poverty is not an impediment to marriage, because of the possibility of acquiring wealth in the future.
‘Ali ibn Abi Talhah said, quoting Ibn ‘Abbaas: Allah encouraged them to get married and enjoined that upon free men and slaves, and promised to make them independent of means, as He said: “If they be poor, Allah will enrich them out of His Bounty” [an-Noor 24:32].
And it was narrated that Ibn Mas‘ood said: “Seek independence of means through marriage.”
Tafseer Ibn Katheer (6/51)
Shaykh Ibn Baaz (may Allah have mercy on him) said:
In this verse, Allah – may He be glorified – enjoined marriage of single and righteous people among slave men and women, and He said – and He speaks the truth – that this is one of the means of attaining bounty for those who are poor, so that husbands and women’s guardians may be reassured that poverty should not be an impediment to marriage; rather marriage is one of the means of attaining provision and independence of means.
End quote from Fataawa Islamiyyah (3/213)
The fact that the one who is able to afford it is encouraged to get married does not mean that one who cannot afford it is not allowed to get married, especially if he fears hardship for himself.
The one who cannot afford it is instructed to fast so as to suppress his desire, but that does not mean that he is not allowed to seek to get married. Perhaps he will find someone who will help him to get married, or perhaps he will find someone who will accept him in his current situation because of his religious commitment and righteousness. These are individual cases that vary according to people’s situations and customs. As for the meaning of the hadeeth of Ibn Mas‘ood, it is a general teaching and advice to those who are not able to get married, instructing them to protect themselves by fasting. If anyone among them finds a means to get married, there is nothing wrong with that; in fact he is encouraged and urged to do so. Hence when he said “and whoever cannot afford it”, he did not say “let him not get married”; rather he said “[he] should fast”, lest he fall into sin. But if he is able to get married with some difficulty, there is undoubtedly nothing wrong with that. Rather fasting is given as an alternative when one is not able to get married; if one is able to get married, even with some difficulty, then that is preferable.
And Allah knows best.