Language:
كتاب الحدود
86  
Limits and Punishments set by Allah (Hudood)
(35)
Chapter: When a female slave commits zina
(35)
بَابُ إِذَا زَنَتِ الأَمَةُ
Sahih al-Bukhari 6837, 6838

Narrated Abu Huraira and Zaid bin Khalid:

The verdict of Allah's Messenger (ﷺ) was sought about an unmarried slave girl guilty of illegal intercourse. He replied, "If she commits illegal sexual intercourse, then flog her (fifty stripes), and if she commits illegal sexual intercourse (after that for the second time), then flog her (fifty stripes), and if she commits illegal sexual intercourse (for the third time), then flog her (fifty stripes) and sell her for even a hair rope." Ibn Shihab said, "I am not sure whether the Prophet (ﷺ) ordered that she be sold after the third or fourth time of committing illegal intercourse."

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يُوسُفَ، أَخْبَرَنَا مَالِكٌ، عَنِ ابْنِ شِهَابٍ، عَنْ عُبَيْدِ اللَّهِ بْنِ عَبْدِ اللَّهِ، عَنْ أَبِي هُرَيْرَةَ، وَزَيْدِ بْنِ خَالِدٍ، رضى الله عنهما أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم سُئِلَ عَنِ الأَمَةِ إِذَا زَنَتْ وَلَمْ تُحْصَنْ قَالَ ‏ "‏ إِذَا زَنَتْ فَاجْلِدُوهَا، ثُمَّ إِنْ زَنَتْ فَاجْلِدُوهَا، ثُمَّ إِنْ زَنَتْ فَاجْلِدُوهَا، ثُمَّ بِيعُوهَا وَلَوْ بِضَفِيرٍ ‏"‏‏.‏ قَالَ ابْنُ شِهَابٍ لاَ أَدْرِي بَعْدَ الثَّالِثَةِ أَوِ الرَّابِعَةِ‏.‏
Reference : Sahih al-Bukhari 6837, 6838
In-book reference : Book 86, Hadith 61
USC-MSA web (English) reference : Vol. 8, Book 82, Hadith 822
  (deprecated numbering scheme)