Al-Anfaal • EN-TAFSIR-IBN-ABBAS
﴿ لَّوْلَا كِتَٰبٌۭ مِّنَ ٱللَّهِ سَبَقَ لَمَسَّكُمْ فِيمَآ أَخَذْتُمْ عَذَابٌ عَظِيمٌۭ ﴾
“Had it not been for a decree from God that had already gone forth, there would indeed have befallen you a tremendous chastisement on account of all [the captives] that you took.”
(Had it not been for an ordinance of Allah which had gone before) had it not been for Allah's decree that spoils of war were lawful for the community of Muhammad (pbuh); it is also said that this means: had it not been that Allah decreed felicity for the people of Badr, (an awful) a severe (doom had come upon you on account of what ye took) would have befallen you because of the ransoms you took.