Allah Ta’ala declares:
“And whatever strikes you of calamities – it is due to what YOUR own hands have earned (i.e. misdeeds); although He overlooks much.” (42:30)
“And verily, We will make them taste of the near lighter torment prior to the greater torment (32:21)
In the Tafseer of Ibn Katheer it is related that Hadhrat Ibn Abbas (radhiyallahu anhu) said regarding the aforementioned verse:
“The near torment means diseases and problems in this world, and the things that happen to its people as a test from Allah to His servants so that they will repent to Him.”
These verses are general and apply to everyone, except the sinless (and virtually sinless) such as the Prophets (alayhis salaam). The trials and tribulations of Prophets, rather than cleansing their non-existent sins, serve instead to raise their ranks and also as an inspiration for their Ummah and future nations.
As for the rest of us who are sinful (i.e. virtually everyone), we should reflect on the verses above, introspect, do Tawbah, and resolve sincerely to abstain from the sins which have caused trials and calamities to descend upon us.
Allah’s Punishment is commensurate with the crime. The worse the crime, the greater the calamity.
Remember! Far far worse than sins are justification (Halaalization) of those sins, and even worse than justification of those sins is propagating your justification by which the doors are opened for others to also soothe their consciences while sinning. The trick of hiding behind scholars who legalize (Halaalize) doubtful matters does not work with this Divine Rule of calamities.
Humble yourself, repent and turn to Allah wholeheartedly, make proper amends (e.g. seek forgiveness of someone wronged), adopt Taqwa (fear of Allah which leads one to abstain from all Haraam and doubtful matters), and you will experience first-hand the Help of Allah and Deliverance from Calamities as guaranteed here by Allah Ta’ala:
“Whosoever adopts Taqwa of Allah, He will make a way out for him (from difficulties), and He (Allah) will provide for him from places he (the afflicted person) could never have imagined.” (65:3)