The Prophet ﷺ said, "No fatigue, illness, anxiety, sorrow, harm, or distress befalls a Muslim, not even a thorn that pricks him, without Allah expiating some of his sins through it."
عن النبي ﷺ قال: ما يصيب المسلم من نصب، ولا وصب، ولا هم ولا حزن، ولا أذى، ولا غم، حتى الشوكة يشاكها، إلا كفر الله بها من خطاياه.
Bukhari narrated it in "The Sick" (5641-5642) from Abdullah bin Muhammad, who said, Abdul-Malik bin Amr told us, Zuhayr bin Muhammad told us, from Muhammad bin Amr bin Halhalah, from Ata bin Yasar, from Abu Saeed Khudri and Abu Hurairah, who mentioned it.Muslim also narrated it in "Righteousness and Kinship Ties" (2573) through another route, from Ata, with similar wording.