I heard the Messenger of Allah ﷺ say, "If the slave-girl of one of you commits fornication and her offence is established, let him flog her with the prescribed punishment without reproaching her. Then if she commits it again, let him flog her with the prescribed punishment without reproaching her. Then if she commits it a third time and her offence is established, let him sell her, even if only for a rope of hair."
حدثنا حجاج حدثنا ليث حدثني سعيد بن أبي سعيد عن أبيه
سمعت رسول الله ﷺ يقول إذا زنت أمة أحدكم فتبين زناها فليجلدها الحد ولا يثرب عليها ثم إن زنت فليجلدها الحد ولا يثرب عليها ثم إن زنت فتبين زناها فليبعها ولو بحبل من شعر