Al-An'am 6:42
وَلَقَدْ أَرْسَلْنَآ إِلَىٰٓ أُمَمٍ مِّن قَبْلِكَ فَأَخَذْنَـٰهُم بِٱلْبَأْسَآءِ وَٱلضَّرَّآءِ لَعَلَّهُمْ يَتَضَرَّعُونَ
Walaqad arsalna ila omamin minqablika faakhathnahum bilba/sa-i waddarra-ilaAAallahum yatadarraAAoon
And We have already sent [messengers] to nations before you, [O Muḥammad]; then We seized them with poverty and hardship that perhaps they might humble themselves [to Us].
We did send messengers to communities before you and put them to hardships and sufferings, so that they may supplicate in humility.