Sahih al-Bukhari, Book 67, Hadith 53 (Bukhari 4911)

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."