The Prophet (ﷺ) forbade taking the earnings of a slave girl by prostitution.
Sahih al-Bukhari Book 68, Hadith 93