The hardships that we suffer in life are means by which our sins are pardoned. These difficulties can take many forms, like sickness, financial misfortune, or the loss of loved ones. Through these trials, Allah grants us atonement for our sins and raises our spiritual status.
Allah tries those of His servants He deems best to test. Consider Job عليه السلام about whom Allah Almighty says:
وَأَيُّوبَ إِذْ نَادَىٰ رَبَّهُ أَنِّي مَسَّنِيَ الضُّرُّ وَأَنتَ أَرْحَمُ الرَّاحِمِينَ
(Remember) Job, when He cried to his Lord, “Truly distress has seized me, but You are the Most Merciful of those who are merciful.”
[Sūrah al-Anbiyā 21:83]