The Messenger of Allah ﷺ said, "If the servant girl of one of you commits fornication, let him flog her and not rebuke her. If she does it a second time, let him flog her and not rebuke her. If she does it a third time, let him flog her and not rebuke her. If she does it a fourth time, let him flog her and sell her, even for a rope of hair or a braid of hair."
حدثنا يحيى بن سعيد بن أبان بن سعيد بن العاص قال حدثنا عبيد الله عن سعيد بن أبي سعيد عن أبيه
قال رسول الله ﷺ إذا زنت خادم أحدكم فليجلدها ولا يعيرها فإن عادت الثانية فليجلدها ولا يعيرها فإن عادت الثالثة فليجلدها ولا يعيرها فإن عادت الرابعة فليجلدها وليبعها بحبل من شعر أو بضفير من شعر
Its isnad is sahih. Bukhari related it, 3/93, in the Book of Sales, on the sale of an adulterous slave, and Muslim, 3/1328, no. 1703, in the Book of Punishments, on the stoning of the Jews, and Abu Dawud, 4/160, no. 4470, in the Book of Punishments, on the female slave who commits adultery.