Slavery as presented in the Old Testament is NOT the kind of slavery you would find in the American South prior to the Civil War. I think that's what people picture when they hear the word "slave", but, basically, it was a kind of indentured servant-hood.
For example, if you, an Israelite, owed money and could not pay the person to whom you owed it, you went to work for him until you worked off your debt. People entered into these agreements of their own accord. They were NOT bought and sold. And every seven years, all slaves were released from the agreement whether they had paid off their debts or not. And the man they worked for had to give them property so that they could start afresh. Some men chose to remain in the employ of their "masters" because it was a good life and they had no desire to be out on their own. And that was THEIR choice.
In the result of war, foreign women and children left without male providers would also become servants because there was no way for them to survive on their own in that culture. Remember that we are not talking about a state where social welfare existed or where women were educated and able to look after themselves economically.
Foreign slaves, like those mentioned in Leviticus 25, would sell themselves as slaves for the same reasons that Israelites did -- they had debts to pay, no source of income -- so it became expedient for them to enter into servant-hood as well.
And note that God implemented laws to protect ALL slaves, Israelite or non-Israelite, not because he condoned slavery, but because men introduced it into society and it was a reality. For example, if you beat or injured your slave, you immediately forfeited your investment in that slave as he would be released (Ex. 20:20-21). If you killed a slave, you yourself would be subject to capital punishment. And if your slave ran away because you mistreated him, he was not returned to you. If you compare slavery in other Ancient Near Eastern countries, you can see how different and how much more lenient the institution was amongst the Israelites. So God did indeed care for these people.
Look at it this way: Our governments introduce laws re: murder, theft, traffic violations, etc., not because they condone those things, but because they know people will commit them. Therefore, they try to regulate things so that chaos will not ensue. That's how it was with God and the Israelites. God gives people free will and knows how they will mess up. He issued commands to the Israelites in response to the way they lived to keep society from degenerating into chaos.
Unfortunately, some people insist that the Israelites should have lived with 21st-century ideas and practices, thus failing to take into consideration that the Ancient Near East is nothing like North America or Western Europe in any way, shape or form. C.S. Lewis rightfully called this attitude chronological snobbery. It's why I think it's important for people to study the cultures in that place and time to help them get a better, more accurate understanding of the people and the way they lived.
Here are a couple of articles on the topic of slavery in the O.T. that go into greater detail:
https://answersingenesis.org/bible-ques ... t-slavery/
https://answeringsceptics.wordpress.com ... s-slavery/
Now let's talk about poor old Jephthah. He decides that he is going to buy God's favour in an upcoming battle with the Amonites by making a vow to sacrifice whoever comes out of his house first. Stupid move. First of all, you cannot bargain with God by promising to do this, that or the other thing. Second of all, God has already condemned human sacrifice (Lev. 18:21 and Deut. 12:31). So not only is J. foolishly trying to manipulate God into backing him in battle, he is trying to do so with a promise that is sure to displease God. The man was, quite simply, an idiot. I feel sorry for his daughter because she had such a stupid father.
There are some scholars who suggest that J. didn't actually have her killed, but that he dedicated her to the Lord and that meant she couldn't marry or have children which was as good as death to an Israelite woman. You can read that argument here:
https://www.thetorah.com/article/did-je ... s-daughter
Either way, the take-away from the event is this: It is stupid to try to make bargains with God. He cannot be manipulated. It is stupid to do things that we think he wants us to do when they run contrary to his will.
And note this: The Book of Judges has one sentence that is repeated over and over and over again. It reads: "Every man did what was right in his own eyes." J. is an example of that. He did what was right in his own eyes, but not what was right in the eyes of God. This is why it is imperative to read these verses in the context of the chapter, the book and the entire Bible. When read in context, their meaning becomes much clearer.
Lastly, it's important to remember that not everything in the Bible is prescriptive. Some of it is descriptive. It is a mistake to try to make what is descriptive prescriptive -- which is what I think some of the participants in this thread are doing.