that Messenger of Allah ﷺ was asked about an unmarried slave-girl who committed illegal sexual intercourse. They heard him saying, "Flog her, and if she commits illegal sexual intercourse after that, flog her again, and on the third (or the fourth) offense, sell her." (Using translation from Bukhārī 2232)
أَخْبَرَهُ أَنَّ أَبَا هُرَيْرَةَ وَزَيْدَ بْنَ خَالِدٍ أَخْبَرَاهُ أَنَّهُمَا سَمِعَا رَسُولَ اللهِ ﷺ وَهُوَ يُسْأَلُ عَنِ الْأَمَةِ تَزْنِي وَلَمْ تُحْصِنْ قَالَ «اجْلِدُوهَا إِنْ زَنَتْ ثُمَّ إِنْ زَنَتْ فَاجْلِدُوهَا ثُمَّ إِنْ زَنَتْ فَاجْلِدُوهَا ثُمَّ بِيعُوهَا وَلَوْ بِضَفِيرٍ بَعْدَ الثَّالِثَةِ أَوِ الرَّابِعَةِ»