Sahih al-Bukhari, Book 68, Hadith 93 (Bukhari 5134)

Narrated Abu Huraira:

The Prophet (ﷺ) forbade taking the earnings of a slave girl by prostitution.