كتاب البر والصلة والآداب
45  
The Book of Virtue, Enjoining Good Manners, and Joining of the Ties of Kinship
(14)
Chapter: The Reward Of The Believer For Whatever Befalls Him Of Sickness, Grief And The Like, Even A Thorn That Pricks Him
(14)
باب ثَوَابِ الْمُؤْمِنِ فِيمَا يُصِيبُهُ مِنْ مَرَضٍ أَوْ حُزْنٍ أَوْ نَحْوِ ذَلِكَ حَتَّى الشَّوْكَةِ يُش
Sahih Muslim 2574

Abu Huraira reported that when this verse was revealed:

"Whoever does evil will be requited for it", and when this was conveyed to the Muslims they were greatly perturbed. Thereupon Allah's Messenger (ﷺ) said: Be moderate and stand firm in trouble that falls to the lot of a Muslim (as that) is an expiation for him; even stumbling on the path or the pricking of a thorn (are an expiation for him). Muslim said that 'Umar b. Abd al-Rahman Muhaisin was from amongst the people of Mecca.
حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، وَأَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ كِلاَهُمَا عَنِ ابْنِ عُيَيْنَةَ، - وَاللَّفْظُ لِقُتَيْبَةَ - حَدَّثَنَا سُفْيَانُ، عَنِ ابْنِ مُحَيْصِنٍ، شَيْخٍ مِنْ قُرَيْشٍ سَمِعَ مُحَمَّدَ بْنَ قَيْسِ بْنِ مَخْرَمَةَ، يُحَدِّثُ عَنْ أَبِي هُرَيْرَةَ، قَالَ لَمَّا نَزَلَتْ ‏{‏ مَنْ يَعْمَلْ سُوءًا يُجْزَ بِهِ‏}‏ بَلَغَتْ مِنَ الْمُسْلِمِينَ مَبْلَغًا شَدِيدًا فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ قَارِبُوا وَسَدِّدُوا فَفِي كُلِّ مَا يُصَابُ بِهِ الْمُسْلِمُ كَفَّارَةٌ حَتَّى النَّكْبَةِ يُنْكَبُهَا أَوِ الشَّوْكَةِ يُشَاكُهَا ‏"‏ ‏.‏ قَالَ مُسْلِمٌ هُوَ عُمَرُ بْنُ عَبْدِ الرَّحْمَنِ بْنِ مُحَيْصِنٍ مِنْ أَهْلِ مَكَّةَ ‏.‏
Reference : Sahih Muslim 2574
In-book reference : Book 45, Hadith 67
USC-MSA web (English) reference : Book 32, Hadith 6243
  (deprecated numbering scheme)