Some ask, doesn't the fact that the Old Testament has laws that allow for slavery constitute an endorsement of slavery? Fr. John Whiteford discusses the Old Testament and slavery.
I have previously addressed the issue of why slavery existed during the period of time that the Scriptures were written, and you can read that article for more on the subject generally:
But to address this specific question, let's consider the question of whether the fact that there are laws regarding divorce in Old Testament constitute an endorsement of divorce. We are told in no uncertain terms that God hates divorce (Malachi 2:16). Christ was asked by the Pharisees about the issue of Divorce in Matthew 19:1-9, and He stated that divorce should not happen: "What God has put together, let not man put asunder". But when asked why the law of Moses allowed for divorce, Christ answered "Moses, because of the hardness of your hearts, permitted you to divorce your wives, but from the beginning it was not so. And I say to you, whoever divorces his wife, except for sexual immorality, and marries another, commits adultery; and whoever marries her who is divorced commits adultery." Divorce is the result of sin, and the Law regulated it in order to place some limitations on it, but this does not mean that divorce is something that God is in favor of.
Likewise, slavery was a universal fact of life in the ancient world, for reasons that are addressed in the above referenced article. In fact, we still have forms of involuntary servitude even in our current legal system. The 13th Amendment, which abolished slavery, allowed for involuntary servitude as a punishment for a crime, and we also still have the potential for a military draft, which is likewise a form of involuntary servitude. And even voluntary military service is somewhat analogous to indentured servitude, because once you make the commitment, you are not simply free to quit, like you would be at a regular job. All this is true, even in our times, in which we have advanced in terms of technology, education, and infrastructure beyond the imaginations of people of ancient times. There is still a social necessity for some forms of involuntary servitude, even now.
It is difficult for us to imagine what life was like during the Old Testament period, but if we want to understand it, we have to make the effort to try. They did not have the United Nations, a prison system, or a much in the way of a welfare system, though there was some provisions made for the poor. However, in those days simply having enough food to eat was a challenge, and for many people, selling themselves into slavery was a preferable option to starvation. The laws we find in the Old Testament provided rights to slaves, and placed limitations on their masters. This was in stark contrast to the pagan world, which generally afforded no rights to slaves at all.
So no, the fact that there were laws to regulate something does not at all suggest that God endorsed it as a good thing.