"And if We had mercy on them and removed the affliction that is upon them," [refers to when] it was revealed regarding the people of Mecca. This was when they were afflicted with famine for seven years, to the point that they ate carrion and bones, and were so exhausted that one of them would see something like smoke between himself and the sky. This is the meaning of His saying: "So watch for the Day when the sky brings a visible smoke." This verse was revealed before they were afflicted with the famine; then they were afflicted by it. So Allah said, while they were in that state of hunger: "And if We had mercy on them and removed the affliction that is upon them, they would persist in their transgression, wandering blindly," meaning they would continue to waver in confusion.
﴿وَلَوْ رَحِمْنَاهُمْ وَكَشَفْنَا مَا بِهِمْ من ضرّ﴾ نَزَلَتْ فِي أَهْلِ مَكَّةَ؛ وَذَلِكَ حِينَ أُخِذُوا بِالْجُوعِ سَبْعَ سِنِينَ؛ حَتَّى أَكَلُوا الْمَيْتَةَ وَالْعِظَامَ وَأُجْهِدُوا؛ حَتَّى جَعَلَ أَحَدُهُمْ يَرَى مَا بَيْنَهُ وَبَيْنَ السَّمَاءِ دُخَانًا، وَهُوَ قَوْلُهُ: ﴿فَارْتَقِبْ يَوْمَ تَأْتِي السَّمَاءُ بِدُخَان مُبين﴾ نزلت هَذِه الْآيَة قبل أَن يُؤْخَذُوا بِالْجُوعِ، ثُمَّ أُخِذُوا بِهِ، فَقَالَ اللَّهُ (وَهُمْ فِي ذَلِكَ الْجُوعِ: ﴿وَلَوْ رَحِمْنَاهُمْ وَكَشَفْنَا مَا بِهِمْ مِنْ ضُرٍّ لَلَجُّوا فِي طغيانهم يعمهون﴾ يَتَرَدَّدُونَ