The prophet (PBUH) said: "When a believer suffers from illness or experiences hardship or loss, grief or feels the prick of a thorn parts of his sins are forgiven.

[Sahih Bukhari and Muslim]