It is a complicated question that requires a comprehensive understanding of multiple factors.
1. Remember that this form of slavery already existed for quite some time and was being regularly practiced. So, Islam’s approach was to regulate it and take steps towards its abolition. Hence you see that it does not exist today, and the Muslim world abolished it long before the West.
2. The Islamic laws treated the slaves as humans and thus they could not be forced (just as a wife cannot be forced).
3. So, in allowing it, people say that Islam is barbaric. However, just because it is allowed, does not mean it should be practiced. The evidence for this is the behavior of the Prophet and the Imams, who married slave women, who were the mothers of Imams. Not only that, but as soon as a slave woman gave birth she and the child became free.
I agree that these acts (what you asked about) are horrifying and barbaric, but due to its deep engraining in society, Islam took a careful approach, and allowed the example of the Prophet and Ahl al-Bayt to show how to act so it could be rid of. This is why it is not seen today. A similar, more trivial, example is that eating halal food is allowed. Someone can overeat and act greedy and it wouldn’t necessarily be haram. However, we follow the example of the m’asoom in how they ate and control ourselves. Again, just because something is legislated as allowed doesn’t mean it should be done