Abdullah (b. Mas’ud) reported:We were on an expedition with Allah’s Messenger (ﷺ) and we had no women with us. We said: Should we not have ourselves castrated? He (the Holy Prophet) forbade us to do so He then granted us permission that we should contract temporary marriage for a stipulated period giving her a garment, and ‘Abdullah then recited this verse: ‘Those who believe do not make unlawful the good things which Allah has made lawful for you, and do not transgress. Allah does not like trangressers” (al-Qur’an, v. 87).
Sahih Muslim Book 16, Hadith 13
Forbidden of temporary marriage
Rabi’ b. Sabra reported that his father went on an expedition with Allah’s Messenger (ﷺ) during the Victory of Mecca, and we stayed there for fifteen days (i. e. for thirteen full days and a day and a night), and Allah’s Messenger (ﷺ) permitted us to contract temporary marriage with women. So I and another person of my tribe went out, and I was more handsome than he, whereas he was almost ugly. Each one of us had a cloaks, My cloak was worn out, whereas the cloak of my cousin was quite new. As we reached the lower or the upper side of Mecca, we came across a young woman like a young smart long-necked she-camel. We said:
Is it possible that one of us may contract temporary marriage with you? She said: What will you give me as a dower? Each one of us spread his cloak. She began to cast a glance on both the persons. My companion also looked at her when she was casting a glance at her side and he said: This cloak of his is worn out, whereas my cloak is quite new. She, however, said twice or thrice: There is no harm in (accepting) this cloak (the old one). So I contracted temporary marriage with her, and I did not come out (of this) until Allah’s Messenger (ﷺ) declared it forbidden.
Sabra al-Juhani reported on the authority of his father that while he was with Allah’s Messenger (ﷺ) he said:
O people, I had permitted you to contract temporary marriage with women, but Allah has forbidden it (now) until the Day of Resurrection. So he who has any (woman with this type of marriage contract) he should let her off, and do not take back anything you have given to them (as dower).
Sahih Muslim Book 16, Hadith 25
Sabra al-Juhanni reported on the authority of his father:
Allah’s Messenger (ﷺ) prohibited the contracting of temporary marriage and said: Behold, it is forbidden from this very day of yours to the Day of Resurrection, and he who has given something (as a dower) should not take it back.
Sahih Muslim Book 16, Hadith 33
As it was common true that before came into the fold of Faith people of Arab was habitual of illegal sexual relationship when they bring faith and become Muslim it was very difficult for them to avoid search practice
Jabir b. ‘Abdullah reported:
We contracted temporary marriage giving a handful of (tales or flour as a dower during the lifetime of Allah’s Messenger (ﷺ) and durnig the time of Abu Bakr until ‘Umar forbade it in the case of ‘Amr b. Huraith.
Sahih Muslim Book 16, Hadith 19
Some of the companions of Prophet Muhammad ﷺ was not aware of this order therefore they did the same thing continously even after the death of Prophet Mohammed pbuh, later on during the time of Hazrat Umar when few cases related to temporary marriage came in front of him then he clarified it and informed to the people that it was prohibited by Prophet Mohammed pbuh himself forever and till the day of judgement