On the day of Hunayn, the Messenger of Allah ﷺ sent an army to Awtas. They met an enemy force and fought them, prevailing over them and capturing female prisoners. Some of the companions of the Messenger of Allah ﷺ felt uneasy about having relations with these women because of their husbands among the polytheists. So Allah revealed concerning this, "And married women, except those your right hands possess" [Nisa 4:24], meaning they are lawful for you once their waiting period has ended.
أن رسول الله ﷺ يوم حنين بعث جيشا إلى أوطاس، فلقوا عدوا فقاتلوهم، فظهروا عليهم، وأصابوا لهم سبايا، فكأن ناسا من أصحاب رسول الله ﷺ تحرجوا من غشيانهن من أجل أزواجهن من المشركين، فأنزل الله عز وجل في ذلك {والمحصنت من النساء إلا ما ملكت أيمنكم} [النساء: ٢٤] أي فهن لكم حلال إذا انقضت عدتهن.
Muslim reported it in the Book of Suckling (1456), from Ubaydullah bin Umar bin Maysara Qawariri, who said, Yazid bin Zuray told us, who said, Saeed bin Abu Aruba told us, from Qatada, from Salih Abu Khalil, from Abu Alqama Hashimi, from Abu Saeed Khudri, and he mentioned it.