Short response: The Holy Qur’an has condemned fornication and adultery . Islam does not permit concubinage, and fornication and adultery trigger the penalty of physical reprimand . Abu Musa al-Ash‘ari recalls that Prophet Muhammad(sa) said, “Any man who has a slave-girl whom he teaches good manners so that she has good manners and educates her in the best possible way and then frees her and marries her has two rewards.” 
One of the meanings of the expression “what your right hand possesses” relates to POWs. The Holy Qur’an has also applied this term to slaves and servants.
And whoso of you cannot afford to marry free, believing women, let him marry what your right hands possess, namely, your believing handmaids. And Allah knows your faith best; you are all one from another; so marry them with the leave of their masters and give them their dowries according to what is fair, they being chaste, not committing fornication, nor taking secret paramours. And if, after they are married, they are guilty of lewdness, they shall have half the punishment prescribed for free women. This is for him among you who fears lest he should commit sin. And that you restrain yourselves is better for you; and Allah is Most Forgiving, Merciful. 
Thus, Islam has allowed for marriages between masters and slaves—a union that would automatically lead to the end of the master-slave relationship. We also see yet another warning against illicit sexual affairs. Likewise, former slaves have been given a degree of leniency with regards to indiscretions they might commit, acknowledging that such people may likely have been brought up in a non-Islamic environment. Among the worst of these indiscretions is adultery, and the punishment would then be half of the standard punishment for adultery.
The verse in question further states, “you are all one from another,” which means that despite being from different social classes, all believing Muslims are equal. No Arab slave master before Islam would have had the gall to reject tradition. No Arab noble would have ever conceived of marrying a slave. But with Islam, the Arabs realized that all men are created equal. Prophet Muhammad(sa) said:
Let none of you call out to his slave saying, ‘My slave boy!’ or ‘My slave girl!’ nor let a slave call out to his master saying, ‘My Lord!’ but let the master call out to the slave saying, ‘My young man!’ or ‘My young woman!’ and let the slave call out to the master as ‘My chief!’ for, verily, ye are all slaves, and your Lord is Allah, the Almighty. 
Prophet Muhammad(sa) inspired a new way of thinking in Arab society and redefined the relationship between master and servant, so much so that he himself married a former slave.
 Qur’an 5:6; 17:33; 25:69; 60:13.
 Qur’an 24:3.
 Qur’an 4:26.
 Sunan Masnad Ahmad, Chap. 9.