Praise be to Allah.
It was narrated that Ibn Mas’ood said: The Prophet (peace and blessings of Allaah be upon him) said: “O young men, whoever among you is able to, let him get married. Whoever is not able to, he must fast, for it will be a shield for him.”
Narrated by al-Bukhaari, 5065; Muslim, 1400
A shield means protection against committing immoral actions.
The scholars differed concerning the meaning of ability here, and there are two opinions. Some of them said that it means the ability to afford the expenses of marriage and spending on one’s wife; others said that it means the ability to have intercourse. There is no conflict between the two meanings, so what it meant is that whoever is able to have intercourse and can afford it, let him get married.
The scholars differed concerning the meaning of ability here, and there are two views which boil down to the same meaning. The sounder of these two views is that what is meant is what the word (al-baa’ah) means in Arabic, which is the ability to have intercourse. So the meaning is, whoever is able to have intercourse because he can afford the expenses of marriage, then let him get married. Whoever is unable to have intercourse because he cannot afford the expenses of marriage, then he has to fast in order to control his desire.
Sharh Muslim, 9/173
Ibn al-Qayyim said:
With regard to the phrase, “whoever among you is able to, let him get married” – the word al-baa’ah was interpreted as meaning intercourse, and as meaning the expenses of marriage. That does not contradict the first meaning.
Rawdat al-Muhibbeen, p. 219
Shaykh al-Islam Ibn Taymiyah said:
The ability to get married is the ability to afford the expenses of marriage, not the ability to have intercourse because the hadeeth is addressed to those who are able to have intercourse. Hence those who cannot afford it are commanded to fast, for it is a shield.
Al-Fataawa al-Kubra, 3/134.