Sahih Bukhari Volume 3, Book 46, Hadith Number 731.

Narated By Abu Huraira and Zaid bin Khalid : The Prophet said, “If a slave-girl (Ama) commits illegal sexual intercourse, scourge her; if she does it again, scourge her again; if she repeats it, scourge her again.” The narrator added that on the third or the fourth offence, the Prophet said, “Sell her even for a hair rope.”