All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Allaah Says (what means): {But let them who find not [the means for] marriage abstain [from sexual relations] until Allaah enriches them from His bounty. And those who seek a contract [for eventual emancipation by purchasing their freedom from their owners for a price agreed upon] from among whom your right hands possess — then make a contract with them if you know there is within them goodness and give them from the wealth of Allaah which He has given you. And do not compel your slave girls to prostitution, if they desire chastity, to seek [thereby] the temporary interests of worldly life. And if someone should compel them, then indeed, Allaah is [to them], after their compulsion, Forgiving and Merciful.}[Quran 24:33]
The above verse is an order from Allaah to whoever is not able to marry to abstain from illegal sexual relations, like the Prophet said: "O young people, whoever is able to marry should marry, and whoever is not able to do so, he should fast, as fasting diminishes his sexual desires." Then the verse advised those who own slaves to make a contract with those slaves who seek such a contract to pay money in order to emancipate themselves.
However, it is not permissible for a woman to commit Zina (adultery or fornication) whether she is a slave woman or a free woman, and it is not permissible for her master to allow her to do so; rather, he is obliged to prevent her from committing Zina according to his ability. This verse was revealed to clarify what used to happen at that time as some hypocrites, like ‘Abdullaah ibn Ubay ibn Salool, used to compel their slave girls to commit Zina so that they would bring them some money, so the verse prohibited them from doing so.
The condition of desiring chastity in the verse is mentioned because it corresponds to the state of being compelled to do so and this is the case in which desiring chastely often exists, because if a slave girl does that out of her own will, then she does not need to be compelled to do that in principle, and this meaning is mentioned by Ibn Al-‘Arabi in his book entitled “Ahkaam Al-Quran” (The Rulings of the Quran).
Allaah Knows best.