According to the Holy Quran and Ahlulbayt (AS), all the tragedies and the worldly tortures that befall those people who have committed sins knowingly, are the result of their own sins.
و ما أَصابَكُمْ مِنْ مُصِيبَةٍ فَبِما كَسَبَتْ أَيْدِيكُمْ وَ يَعْفُوا عَنْ كَثِيرٍ
" "Whatever hardship befalls you is the result of your own deeds. God pardons many of your sins."
That is to say, all the catastrophic events and the miseries that afflict the societies such as famine, economical problems, flood, earthquake and etc… are all due to the sins which are committed by the people, however, they are not the result of all their sins, because the Almighty God forgives so many of their sins due to his mercy and wisdom, otherwise no living creatures would survive.
source : erfan.ir