I think we can reconcile these passages with slavery. As neighboring nations practiced brutal behaviors, a complete removal of slavery was not economically viable at the time (it was even necessary to hold Israel together as a nation to bring in the Messiah). But do find justice as best as is possible for the times. If we lived in those brutal times, we would have more empathy for the temporary measure of slavery. Though, of course, today it is totally outlawed. But it does take place in other forms nonetheless which is not acceptable.

"He ensures that orphans and widows receive justice. He shows love to the foreigners living among you and gives them food and clothing" (Deut. 10.18). How can this be done in view of slavery? Is it the same type of slavery we see today?

"True justice must be given to foreigners living among you and to orphans, and you must never accept a widow’s garment as security for her debt" (Deut. 24.17).

“Give justice to the poor and the orphan; uphold the rights of the oppressed and the destitute" (Ps. 82.3).

"Learn to do good. Seek justice. Help the oppressed. Defend the cause of orphans. Fight for the rights of widows" (Is. 1.17).

"Only if you stop exploiting foreigners, orphans, and widows; only if you stop your murdering; and only if you stop harming yourselves by worshiping idols" (Jer. 7.6).

"Fathers and mothers are treated with contempt. Foreigners are forced to pay for protection. Orphans and widows are wronged and oppressed among you" (Ez. 22.7). Israel did sin these sins so they were punished.