كتاب الرضاع
17
The Book of Suckling
(9)
Chapter: It is permissible to have intercourse with a female captive after it is established that she is not pregnant, and if she has a husband, then her marriage is annulled when she is captured
(9)
باب جَوَازِ وَطْءِ الْمَسْبِيَّةِ بَعْدَ الاِسْتِبْرَاءِ وَإِنْ كَانَ لَهَا زَوْجٌ انْفَسَخَ نِكَاحُهَا بِالسَّبْي

Abu Sa'id al-Khudri (Allah her pleased with him) reported that at the Battle of Hanain Allah's Messenger (ﷺ) sent an army to Autas and encountered the enemy and fought with them. Having overcome them and taken them captives, the Companions of Allah's Messenger (may peace te upon him) seemed to refrain from having intercourse with captive women because of their husbands being polytheists. Then Allah, Most High, sent down regarding that:

" And women already married, except those whom your right hands possess (iv. 24)" (i. e. they were lawful for them when their 'Idda period came to an end).
حَدَّثَنَا عُبَيْدُ اللَّهِ بْنُ عُمَرَ بْنِ مَيْسَرَةَ الْقَوَارِيرِيُّ، حَدَّثَنَا يَزِيدُ بْنُ زُرَيْعٍ، حَدَّثَنَا سَعِيدُ، بْنُ أَبِي عَرُوبَةَ عَنْ قَتَادَةَ، عَنْ صَالِحٍ أَبِي الْخَلِيلِ، عَنْ أَبِي عَلْقَمَةَ الْهَاشِمِيِّ، عَنْ أَبِي سَعِيدٍ، الْخُدْرِيِّ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم يَوْمَ حُنَيْنٍ بَعَثَ جَيْشًا إِلَى أَوْطَاسٍ فَلَقُوا عَدُوًّا فَقَاتَلُوهُمْ فَظَهَرُوا عَلَيْهِمْ وَأَصَابُوا لَهُمْ سَبَايَا فَكَأَنَّ نَاسًا مِنْ أَصْحَابِ رَسُولِ اللَّهِ صلى الله عليه وسلم تَحَرَّجُوا مِنْ غِشْيَانِهِنَّ مِنْ أَجْلِ أَزْوَاجِهِنَّ مِنَ الْمُشْرِكِينَ فَأَنْزَلَ اللَّهُ عَزَّ وَجَلَّ فِي ذَلِكَ ‏{‏ وَالْمُحْصَنَاتُ مِنَ النِّسَاءِ إِلاَّ مَا مَلَكَتْ أَيْمَانُكُمْ‏}‏ أَىْ فَهُنَّ لَكُمْ حَلاَلٌ إِذَا انْقَضَتْ عِدَّتُهُنَّ ‏.‏
Reference : Sahih Muslim 1456 a
In-book reference : Book 17, Hadith 41
USC-MSA web (English) reference : Book 8, Hadith 3432
  (deprecated numbering scheme)