I've pondered this question as well. Slavery in any form certainly seems immoral to our modern sensibilities. There are questions about other areas of Torah that raise similar moral concerns.
The understanding that I have arrived at is that the Torah balances two factors:
- The highest ideals.
- Pragmatism.
The Torah ideal is universal rights for all people in a world of peace and equality.
Yet, the practical realities of the world at that time where so far from this ideal. Therefore, it was necessary to have bridge that helps move society toward the ideal.
Some relevant sources:
The ideal:
All people will serve G-d united.
Tzefania 3:9
כִּי־אָז אֶהְפֹּךְ אֶל־עַמִּים שָׂפָה בְרוּרָה לִקְרֹא כֻלָּם בְּשֵׁם יְהוָה לְעָבְדוֹ שְׁכֶם אֶחָד׃
For then I will make the peoples pure of speech, So that they all invoke the LORD by name And serve Him with one accord.
Even the simple meaning of the Shema prayer invokes this universalism, (not monotheism), as Rashi explains on the verse
ה׳ אלהינו ה' אחד means, The Lord who is now our God and not the God of the other peoples of the world, He will at some future time be the One (sole) ה׳, as it is said, (Zephaniah 3:9) “For then I will turn to the peoples a pure language that they may all call upon the name of the Lord", and it is further said, (Zechariah 14:9) “In that day shall the Lord be One (אחד) and His name One" (cf. Sifrei Devarim 31:10).
More specifically about slavery, the sages did not approve of slave ownership as an ideal (Mishneh Torah, Gifts to the Poor, 10:7):
צִוּוּ חֲכָמִים שֶׁיִּהְיוּ בְּנֵי בֵּיתוֹ שֶׁל אָדָם עֲנִיִּים וִיתוֹמִים בִּמְקוֹם הָעֲבָדִים. מוּטָב לוֹ לְהִשְׁתַּמֵּשׁ בְּאֵלּוּ וְיֵהָנוּ בְּנֵי אַבְרָהָם יִצְחָק וְיַעֲקֹב מִנְּכָסָיו וְלֹא יֵהָנוּ בָּהֶם זֶרַע חָם. שֶׁכָּל הַמַּרְבֶּה עֲבָדִים בְּכָל יוֹם וָיוֹם מוֹסִיף חֵטְא וְעָוֹן בָּעוֹלָם. וְאִם יִהְיוּ עֲנִיִּים בְּנֵי בֵּיתוֹ בְּכָל שָׁעָה וְשָׁעָה מוֹסִיף זְכֻיּוֹת וּמִצְוֹת:
The sages commanded that the poor and orphans should be members of one's household instead of servants. It is better to use their services [by employing them] and that the children of Abraham, Isaac, and Jacob benefit from one's property and not the descendants of Ham, for one who increases the number of servants each and every day adds to the sin and iniquity of the world. But if the poor are made members of one's household, each and every hour one adds merit and mitzvot.
The pragmatic:
If you do own a slave, this is the recommended treatment (Mishneh Torah, Slaves 9:8):
מֻתָּר לַעֲבֹד בְּעֶבֶד כְּנַעֲנִי בְּפָרֶךְ. וְאַף עַל פִּי
שֶׁהַדִּין כָּךְ מִדַּת חֲסִידוּת וְדַרְכֵי חָכְמָה שֶׁיִּהְיֶה אָדָם
רַחְמָן וְרוֹדֵף צֶדֶק וְלֹא יַכְבִּיד עֵלּוֹ עַל עַבְדּוֹ וְלֹא יָצֵר
לוֹ וְיַאֲכִילֵהוּ וְיַשְׁקֵהוּ מִכָּל מַאֲכָל וּמִכָּל מִשְׁתֶּה.
חֲכָמִים הָרִאשׁוֹנִים הָיוּ נוֹתְנִין לָעֶבֶד מִכָּל תַּבְשִׁיל
וְתַבְשִׁיל שֶׁהָיוּ אוֹכְלִין. וּמַקְדִּימִין מְזוֹן הַבְּהֵמוֹת
וְהָעֲבָדִים לִסְעוּדַת עַצְמָן. הֲרֵי הוּא אוֹמֵר (תהילים קכג ב)
"כְעֵינֵי עֲבָדִים אֶל יַד אֲדוֹנֵיהֶם כְּעֵינֵי שִׁפְחָה אֶל יַד
גְּבִרְתָּהּ". וְכֵן לֹא יְבַזֵּהוּ בַּיָּד וְלֹא בִּדְבָרִים.
לְעַבְדוּת מְסָרָן הַכָּתוּב לֹא לְבוּשָׁה. וְלֹא יַרְבֶּה עָלָיו
צְעָקָה וְכַעַס אֶלָּא יְדַבֵּר עִמּוֹ בְּנַחַת וְיִשְׁמַע
טַעֲנוֹתָיו. וְכֵן מְפֹרָשׁ בְּדַרְכֵי אִיּוֹב הַטּוֹבִים
שֶׁהִשְׁתַּבֵּחַ בָּהֶן (איוב לא יג) "אִם אֶמְאַס מִשְׁפַּט עַבְדִּי
וַאֲמָתִי בְּרִבָם עִמָּדִי" (איוב לא טו) "הֲלֹא בַבֶּטֶן עשֵֹׁנִי
עָשָׂהוּ וַיְכֻנֶנּוּ בָּרֶחֶם אֶחָד". וְאֵין הָאַכְזָרִיּוּת
וְהָעַזּוּת מְצוּיָה אֶלָּא בְּעַכּוּ''ם עוֹבְדֵי עֲבוֹדָה זָרָה אֲבָל
זַרְעוֹ שֶׁל אַבְרָהָם אָבִינוּ וְהֵם יִשְׂרָאֵל שֶׁהִשְׁפִּיעַ לָהֶם
הַקָּדוֹשׁ בָּרוּךְ הוּא טוֹבַת הַתּוֹרָה וְצִוָּה אוֹתָם בְּחֻקִּים
וּמִשְׁפָּטִים צַדִּיקִים רַחְמָנִים הֵם עַל הַכּל. וְכֵן
בְּמִדּוֹתָיו שֶׁל הַקָּדוֹשׁ בָּרוּךְ הוּא שֶּׁצִּוָּנוּ לְהִדָּמוֹת
בָּהֶם הוּא אוֹמֵר (תהילים קמה ט) "וְרַחֲמָיו עַל כָּל מַעֲשָׂיו".
וְכָל הַמְרַחֵם מְרַחֲמִין עָלָיו שֶׁנֶּאֱמַר (דברים יג יח) "וְנָתַן
לְךָ רַחֲמִים וְרִחַמְךָ וְהִרְבֶּךָ":
It is permissible to work a heathen slave relentlessly. Even though it
is lawful, the quality of benevolence and the paths of wisdom demand
of a human being to be merciful and striving for justice. One should
not press his heavy yoke on his slave and torment him, but should give
him to eat and drink of everything. The sages of old were in the habit
of sharing with the slave every dish they ate, and they fed the cattle
as well as the slaves before they themselves sat down to eat.— — Nor
should a master disgrace his servant by hand or by words; the biblical
law surrendered them to servitude, but not to disgrace (Niddah 47a).
He should not madly scream at his servant, but speak to him gently and
listen to his complaints.— — Cruelty is frequently to be found only
among heathen who worship idols. The progeny of our father Abraham,
however, the people of Israel upon whom God bestowed the goodness of
the Torah, commanding them to keep the laws of goodness, are merciful
toward all creatures. So too, in speaking of the divine attributes,
which he has commanded us to imitate, the psalmist says: "His mercy is
over all his works" (Psalm 145:9). Whoever is merciful will receive
mercy, as it is written: "He will be merciful and compassionate to you
and multiply you" (Deuteronomy 13:18).
Likewise, we are forbidden to return a runaway slave (Mishneh Torah, Slaves 8:10):
עֶבֶד שֶׁבָּרַח מִחוּצָה לָאָרֶץ לָאָרֶץ אֵין מַחֲזִירִין לוֹ לְעַבְדוּת וְעָלָיו נֶאֱמַר (דברים כג טז) "לֹא תַסְגִּיר עֶבֶד אֶל אֲדֹנָיו". וְאוֹמֵר לְרַבּוֹ שֶׁיִּכְתֹּב לוֹ גֵּט שִׁחְרוּר וְיִכְתֹּב לוֹ שְׁטַר חוֹב בְּדָמָיו עַד שֶׁתַּשִּׂיג יָדוֹ וְיִתֵּן לוֹ. וְאִם לֹא רָצָה הָאָדוֹן לְשַׁחְרְרוֹ מַפְקִיעִין בֵּית דִּין שִׁעְבּוּדוֹ מֵעָלָיו וְיֵלֵךְ לוֹ:
- When a slave flees from the diaspora to Eretz Yisrael, he should not be returned to slavery. Concerning such a person, the Torah Deuteronomy 23:16 states: "Do not return a slave to his master." His master is told to compose a bill of release for him, and he writes a promissory note for his master for his worth, which the master holds until the freed slave earns that money and gives it to him. If the master does not desire to free him, the court invalidates his ownership of him, and the slave is free to go on his way.
There is certainly more to be said about the topic, but it is perhaps a starting point.
I also think it is important to point out that the translation "treat slaves ruthlessly" is not entirely accurate. One may work them very hard, but one may not cause them serious bodily harm. This is not to say that slavery is not terrible on its own, but they are extended basic human rights. Perhaps similar to the rights of a prisoner today.
I think it worth looking more into the requirement that a slave partially convert. It seems to me that both Jewish and non-Jewish slavery was seen by Torah to be used as a rehabilitative or educational process. Again, not because this is necessarily the best way to educate someone, but given the realities, this was sometimes the best option available.
If someone, or a segment of society, is hostile to living a civilized life, you need to coheres them to act properly until they become refined. (Like a thief being forced to act as a servant, preparing them to reenter society).
A society that accepts slavery should at least learn to use it as a tool for good, until the time when it can be abolished.
It is hard to accept at times, but unfortunately, the only way to improve the world is one step at a time.
Likewise, war is obviously not an ideal, and yet we have laws of war.
Also, I think it is worth adding that we have not really abolished slavery in the Western World, we have just outsourced it to places out of sight, where conditions are often worse. Most of our goods are produced by actual or virtual slaves. Does this really make our modern world more just?