By getting married to slaves regardless of their social hardship, Islam encouraged Muslims to value people on other basis than their social class, and henceforth; find a balance between the differences established by the ethnic-tribal system at that time.
It is absolutely the main verse that states a provision on marriage with a category of non-Muslims.
Allah says: “Do not marry idolatresses (al mushrikāt) till they believe; and certainly a believing maid is better than an idolatress even though she would please you; and do not marry idolaters (al Mushrikīn) till they believe (hata yūminū), and certainly a believing slave is better than an idolater, even though he would please you.
While the Qur’an acknowledges the possibility of a mutual attraction between a believer, man or woman, and a polytheist, it strongly recommends against such alliance.
The verse seems to urge Muslim men and women to choose the modest believing slaves over the rich arrogant polytheists even if the latter would look more attractive than the poor slaves.
The Qur’an urges Muslim men and women to get married to believers who had, like them, such faith awareness and were conscious of justice on earth.