Sahih al-Bukhari, Volume 7, Book 62, Hadith 13 (USC-MSA) ⓘ
Narrated 'Abdullah: We used to participate in the holy battles led by Allah's Messenger and we had nothing (no wives) with us. So we said, "Shall we get ourselves castrated?" He forbade us that and then allowed us to marry women with a temporary contract (2) and recited to us: -- 'O you who believe ! Make not unlawful the good things which Allah has made lawful for you, but commit no transgression.' (5.87)
حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا جَرِيرٌ، عَنْ إِسْمَاعِيلَ، عَنْ قَيْسٍ، قَالَ قَالَ عَبْدُ اللَّهِ كُنَّا نَغْزُو مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم وَلَيْسَ لَنَا شَىْءٌ فَقُلْنَا أَلاَ نَسْتَخْصِي فَنَهَانَا عَنْ ذَلِكَ ثُمَّ رَخَّصَ لَنَا أَنْ نَنْكِحَ الْمَرْأَةَ بِالثَّوْبِ، ثُمَّ قَرَأَ عَلَيْنَا {يَا أَيُّهَا الَّذِينَ آمَنُوا لاَ تُحَرِّمُوا طَيِّبَاتِ مَا أَحَلَّ اللَّهُ لَكُمْ وَلاَ تَعْتَدُوا إِنَّ اللَّهَ لاَ يُحِبُّ الْمُعْتَدِينَ}.
also referenced under: Book 67, Hadith 13 (In-Book) & Hadith 5075 (DarusSalam)
Narrated Abu Huraira: I said, "O Allah's Messenger! I am a young man and I am afraid that I may commit illegal sexual intercourse and I cannot afford to marry." He kept silent, and then repeated my question once again, but he kept silent. I said the same (for the third time) and he remained silent. Then repeated my question (for the fourth time), and only then the Prophet said, "O Abu Huraira! The pen has dried after writing what you are going to confront. So (it does not matter whether you) get yourself castrated or not."
وَقَالَ أَصْبَغُ أَخْبَرَنِي ابْنُ وَهْبٍ، عَنْ يُونُسَ بْنِ يَزِيدَ، عَنِ ابْنِ شِهَابٍ، عَنْ أَبِي سَلَمَةَ، عَنْ أَبِي هُرَيْرَةَ ـ رضى الله عنه ـ قَالَ قُلْتُ يَا رَسُولَ اللَّهِ إِنِّي رَجُلٌ شَابٌّ وَأَنَا أَخَافُ عَلَى نَفْسِي الْعَنَتَ وَلاَ أَجِدُ مَا أَتَزَوَّجُ بِهِ النِّسَاءَ، فَسَكَتَ عَنِّي، ثُمَّ قُلْتُ مِثْلَ ذَلِكَ، فَسَكَتَ عَنِّي ثُمَّ قُلْتُ مِثْلَ ذَلِكَ، فَسَكَتَ عَنِّي ثُمَّ قُلْتُ مِثْلَ ذَلِكَ، فَقَالَ النَّبِيُّ صلى الله عليه وسلم " يَا أَبَا هُرَيْرَةَ جَفَّ الْقَلَمُ بِمَا أَنْتَ لاَقٍ، فَاخْتَصِ عَلَى ذَلِكَ أَوْ ذَرْ " .
also referenced under: Book 67, Hadith 14 (In-Book) & Hadith 5076 (DarusSalam)