Language:
كتاب النكاح
67  
Wedlock, Marriage (Nikaah)
(32)
Chapter: Allah's Messenger (saws) prohibited Nikah-al-Mut'a lately.
(31)
باب نَهْىِ رَسُولِ اللَّهِ صلى الله عليه وسلم عَنْ نِكَاحِ الْمُتْعَةِ آخِرًا
Sahih al-Bukhari 5116

Narrated Abu Jamra:

I heard Ibn `Abbas (giving a verdict) when he was asked about the Mut'a with the women, and he permitted it (Nikah-al-Mut'a). On that a freed slave of his said to him, "That is only when it is very badly needed and women are scarce." On that, Ibn `Abbas said, "Yes."

حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا غُنْدَرٌ، حَدَّثَنَا شُعْبَةُ، عَنْ أَبِي جَمْرَةَ، قَالَ سَمِعْتُ ابْنَ عَبَّاسٍ، سُئِلَ عَنْ مُتْعَةِ النِّسَاءِ، فَرَخَّصَ فَقَالَ لَهُ مَوْلًى لَهُ إِنَّمَا ذَلِكَ فِي الْحَالِ الشَّدِيدِ وَفِي النِّسَاءِ قِلَّةٌ أَوْ نَحْوَهُ‏.‏ فَقَالَ ابْنُ عَبَّاسٍ نَعَمْ‏.‏
Reference : Sahih al-Bukhari 5116
In-book reference : Book 67, Hadith 53
USC-MSA web (English) reference : Vol. 7, Book 62, Hadith 51
  (deprecated numbering scheme)