Some argue that God is immoral because the Bible condones slavery. However, there are several responses to this argument.
20 “When a man strikes his slave, male or female, with a rod and the slave dies under his hand, he shall be avenged. 21 But if the slave survives a day or two, he is not to be avenged, for the slave is his money.Exodus 21:20-21
As for your male and female slaves whom you may have: you may buy male and female slaves from among the nations that are around you.Leviticus 25:44
God sometimes works within fallen systems, regulating them from excessive abuse, instead of eliminating them. For example, this is what God did with divorce in the Old Testament. In Matthew 19:8, Jesus says this:
Because of your hardness of heart Moses allowed you to divorce your wives, but from the beginning it was not so.Matthew 19:8
Here, Jesus says that God allowed for divorce “because of your hardness of heart,” but that it was still wrong because “from the beginning it was not so.”
Similarly, slavery already existed in the Roman empire in the New Testament, and it would have been unrealistic to simply say that slavery shouldn’t exist. Instead, God worked within the existing institution, providing principles for how to live within this existing institution of slavery.
There were times in the Old Testament when slavery occurred as a result of war with pagan nations. In these instances, the alternative to slavery would have been to kill every single individual in the pagan nation.
Taking prisoners, or slaves, was an alternative to killing every single individual and was merciful in that it spared innocent lives (innocent in the sense of not actively participating in the war, not innocent before God).
Even if the women and children were not directly killed, there would have been no way for them to survive on their own apart from the rest of their nation, so taking them as prisoners, or slaves, would have still been the more merciful option.
Sometimes, when the Bible refers to “slavery,” it is not referring to forced enslavement, but rather to voluntary indentured servitude, which was not a sin.
There are some foundational principles that apply to all alleged and apparent contradictions in the Bible. To read more, see Bible Difficulties: Foundational Principles.
To read more answers to alleged and apparent contradictions in the Bible, see “Contradictions” in the Bible Answered.
These books are also excellent resources: