Umar bin Khattab reported,

On the day of Badr, the Prophet ﷺ accepted ransom from the captives, and Allah عز وجل revealed, "It is not fitting for a prophet that he should have prisoners of war until he has thoroughly subdued the land," up to His saying, "a severe punishment would have touched you for what you took" [Anfal 8:67–68], referring to the ransom. Then Allah made the spoils of war lawful for them.

Abu Dawud 2690

Sahih

حدثنا أحمد بن محمد بن حنبل قال حدثنا أبو نوح قال أخبرنا عكرمة بن عمار قال حدثنا سماك الحنفي قال حدثني ابن عباس قال

حدثني عمر بن الخطاب قال

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

أبو داود 2690صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Jihad
Chapter
Ransoming captives with wealth
Numbering
Darussalam 2690
Abu Dawud 2690