I heard the Messenger of Allah ﷺ say, "Nothing afflicts a believer in his body causing him pain except that Allah wipes away some of his sins because of it."
حدثنا يعلى بن عبيد قال حدثنا طلحة يعني ابن يحيى عن أبي بردة
سمعت رسول الله ﷺ يقول ما من شيء يصيب المؤمن في جسده يؤذيه إلا كفر الله عنه به من سيئاته