Sahih al-Bukhari, Book 67, Hadith 54 (Bukhari 4912)

Narrated Jabir bin `Abdullah and Salama bin Al-Akwa`:

While we were in an army, Allah's Messenger (ﷺ) came to us and said, "You have been allowed to do the Mut'a (marriage), so do it."