Sabra reported,

We set out with the Messenger of Allah ﷺ on the Farewell Pilgrimage. The men said, "Messenger of Allah, celibacy has become very difficult for us."He said, "Then enjoy temporary marriage with these women."So we approached them, but they refused to marry us unless we set a fixed term between ourselves and them. The men mentioned this to the Prophet ﷺ, and he said, "Set a fixed term between yourselves and them."So I went out together with a cousin of mine. He had a cloak with him, and I had a cloak too, but his cloak was finer than mine, while I was younger than he was. We came upon a woman, and she said, "A cloak is like a cloak."So I married her and stayed with her that night. Then I went out in the morning, and there was the Messenger of Allah ﷺ standing between the Corner and the Door, saying, "People, I had previously permitted you to engage in temporary marriage. Know that Allah has now forbidden it until the Day of Resurrection. So whoever has any of these women with him, let him release her, and do not take back anything of what you have given them."

Ibn Majah 1962

Sahih

حدثنا أبو بكر بن أبي شيبة حدثنا عبدة بن سليمان عن عبد العزيز بن عمر

عن الربيع بن سبرة عن أبيه قال

خرجنا مع رسول الله ﷺ في حجة الوداع فقالوا يا رسول الله إن العزبة قد اشتدت علينا قال فاستمتعوا من هذه النساء فأتيناهن فأبين أن ينكحننا إلا أن نجعل بيننا وبينهن أجلا فذكروا ذلك للنبي ﷺ فقال اجعلوا بينكم وبينهن أجلا فخرجت أنا وابن عم لي معه برد ومعي برد وبرده أجود من بردي وأنا أشب منه فأتينا على امرأة فقالت برد كبرد فتزوجتها فمكثت عندها تلك الليلة ثم غدوت ورسول الله ﷺ قائم بين الركن والباب وهو يقول أيها الناس إني قد كنت أذنت لكم في الاستمتاع ألا وإن الله قد حرمها إلى يوم القيامة فمن كان عنده منهن شيء فليخل سبيلها ولا تأخذوا مما آتيتموهن شيئا

ابن ماجه 1962صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Marriage
Chapter
Prohibition of temporary marriage
Numbering
Darussalam 1962
Ibn Majah 1962