Yes. The Prophet ﷺ said, "No fatigue, illness, worry, grief, harm, or distress befalls a Muslim, even a thorn that pricks him, but Allah expiates some of his sins by it." Trials met with patience are a mercy that purifies the believer and raises his rank. This expiation does not cancel the duty to repent from sins one chose to commit, but it is a profound consolation and reward for the one being tested.
Evidence — the daleel
Sahih al-Bukhari 5641 ṢaḥīḥSahih Muslim 2573 Ṣaḥīḥ
On deen2u
Informational, not a personal fatwa. Consult a qualified scholar for rulings on your situation.