Surah Al-A'raf 7:94
وَمَآ أَرْسَلْنَا فِى قَرْيَةٍ مِّن نَّبِىٍّ إِلَّآ أَخَذْنَآ أَهْلَهَا بِٱلْبَأْسَآءِ وَٱلضَّرَّآءِ لَعَلَّهُمْ يَضَّرَّعُونَ
And We sent to no city a prophet [who was denied] except that We seized its people with poverty and hardship that they might humble themselves [to Allāh].
Translation: Saheeh International
Tafsir
And We did not send a prophet to any city but that when they denied him We seized We punished its people with misery abject poverty and hardship illness so that they might be humble so that they might be self-effaced and so believe.
Excerpt from Tafsir al-Jalalayn, commentary on 7:94, via Quran.com. The reader has the full commentary and 9 more tafsirs.