Whoever is not able to marry, is recommended to fast
باب مَنْ لَمْ يَسْتَطِعِ الْبَاءَةَ فَلْيَصُمْ
Sahih al-Bukhari, Book of Wedlock, Marriage (Nikaah)(view book)
Sahih al-Bukhari 5066
Narrated 'Abdullah:
We were with the Prophet while we were young and had no wealth whatever. So Allah's Apostle ﷺ said, "O young people! Whoever among you can marry, should marry, because it helps him lower his gaze and guard his modesty (i.e. his private parts from committing illegal sexual intercourse etc.), and whoever is not able to marry, should fast, as fasting diminishes his sexual power."
حَدَّثَنَا عُمَرُ بْنُ حَفْصِ بْنِ غِيَاثٍ، حَدَّثَنَا أَبِي، حَدَّثَنَا الأَعْمَشُ، قَالَ حَدَّثَنِي عُمَارَةُ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ يَزِيدَ، قَالَ دَخَلْتُ مَعَ عَلْقَمَةَ وَالأَسْوَدِ عَلَى عَبْدِ اللَّهِ فَقَالَ عَبْدُ اللَّهِ كُنَّا مَعَ النَّبِيِّ ﷺ شَبَابًا لاَ نَجِدُ شَيْئًا فَقَالَ لَنَا رَسُولُ اللَّهُ ﷺ " يَا مَعْشَرَ الشَّبَابِ مَنِ اسْتَطَاعَ الْبَاءَةَ فَلْيَتَزَوَّجْ، فَإِنَّهُ أَغَضُّ لِلْبَصَرِ، وَأَحْصَنُ لِلْفَرْجِ، وَمَنْ لَمْ يَسْتَطِعْ فَعَلَيْهِ بِالصَّوْمِ، فَإِنَّهُ لَهُ وِجَاءٌ ".