Abu Jahl said, "Allah, if this is truly the truth from You, then rain down stones upon us from the sky, or bring upon us a painful punishment" [Anfal 8:32].So the following was revealed, "But Allah would not punish them while you were among them, nor would Allah punish them while they were seeking forgiveness. But what is the matter with them, that Allah should not punish them, when they bar people from Masjid al-Haram" [Anfal 8:33–34], to the end of the verse.
قال أبو جهل: {اللهم إن كان هذا هو الحق من عندك فأمطر علينا حجارة من السماء أو ائتنا بعذاب أليم}. فنزلت {وما كان الله ليعذبهم وأنت فيهم وما كان الله معذبهم وهم يستغفرون وما لهم ألا يعذبهم الله وهم يصدون عن المسجد الحرام} الآية.
Bukhari narrated it in the tafsir (4649), and Muslim in the description of the Resurrection (2796), both through the route of Ubaydullah bin Muaz Anbari, who said, my father narrated to us, Shubah narrated to us, from Abdul-Hameed, the companion of Ziyadi, that he heard Anas bin Malik say... and he mentioned it.Regarding the words of Allah Most High, "Allah would not punish them while you are among them, and Allah would not punish them while they seek forgiveness" [Anfal 8:33], this means that the presence of the Prophet ﷺ prevents the punishment from befalling them, and this was an honor for him ﷺ. When he left Makkah for Madinah, and the remaining Muslims continued seeking Allah's forgiveness, they were spared the punishment, this being the second thing preventing the punishment from befalling them. Then when these people also left Makkah, and permission was given for the conquest of Makkah, the punishment mentioned in the following verse befell them, which is His saying, "But why should Allah not punish them when they obstruct access to Masjid al-Haram" [Anfal 8:34]