"We did not send to any town a Nabi, but We afflicted its inhabitants with misfortune and hardship so that they become humble."
(Aayat 94 Surah Al-A’raaf)
Initially the purpose of Divine Punishment is to induce humility in the transgressors so that they realise their errors and repent. Trials on earth are also designed for our betterment and reformation. When afflicted with misfortune, the Mu’min is required to repent, recite Istighfaar in abundance and reform himself.