Sayyiduna Ibn Abbas (may Allah be pleased with them both) said: In the early days of Islam there was the practice of mut'ah (temporary marriage), and people used to recite this verse: "So for whatever you enjoy of them" [Surah al-Nisa: 24] for an appointed term. A man would come to a town where he had no acquaintances, and he would marry for as long as he estimated it would take him to fulfil his need, so that she would look after his belongings and keep his affairs in order, until this verse was revealed: "Forbidden to you are your mothers" [Surah al-Nisa: 23] to the end of the verse. Then the fixing of a term was abrogated and mut'ah was made unlawful. Its confirmation in the Qur'an is this verse: "Except from their wives or those their right hands possess, for indeed they are not to be blamed" [Surah al-Mu'minun: 6]. So any private relations other than this are unlawful.
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 10736