The Messenger of Allah ﷺ permitted temporary marriage for three days during the year of Awtas, then he forbade it.
رخص رسول الله ﷺ عام أوطاس في المتعة ثلاثا، ثم نهى عنها.
Muslim narrated it in the Book of Marriage (18:1405) from Abu Bakr bin Abu Shayba, who said, Yunus bin Muhammad told us, Abdul-Wahid bin Ziyad told us, Abu Umays told us, from Iyas bin Salama, from his father, who said what has already been mentioned. The year of Awtas and the year of the Conquest are one and the same, for Awtas is the Battle of Hunayn, which took place shortly after the Conquest. It is also called the Battle of Hawazin, because they came to fight the Messenger of Allah ﷺ. So both the permission and the prohibition are attributed to the two names together, and the statement of the one who said, "We enjoyed temporary marriage at Awtas," refers to the Conquest.