Volume 7 · Book 70 · Hadith 544
Narrated 'Aisha: (the wife of the Prophet) Allah's Apostle said, "No calamity befalls a Muslim but that Allah expiates some of his sins because of it, even though it were the prick he receives from a thorn."
— Sahih Bukhari, Volume 7, Book 70: Patients, Hadith #544