God must have considered the treatment of the Israelites by the Egyptians to be morally wrong, because he brought them out of Egypt. So God is not telling the Israelites they can be like the Egyptians. But given that he says the land belongs to the Israelites, this means foreigners could only settle there as guests or servants. I think that is the meaning.
Why doesn't it say that then?
Why is it that God can never inspire the Bible writers to use plain language?
You look at this exactly backwards. You have moral principles which include "slavery is bad" so, when you see a passage in the Bible that simply accepts slavery as a fact of life instead of condemning it, you have to find a way to spin it.
I see four possibilities
1. God inspired the Bible and it says what he wants it to say. i.e. he's OK with slavery
2. God inspired the Bible and it says something he didn't want t to say but you can cleverly interpret it differently. i.e. God is an idiot who can't communicate.
3. Humans wrote the Bible and it says what they want it to say. i.e. they're OK with slavery
4. Humans wrote the Bible and it says something they didn't want t to say but you can cleverly interpret it differently. i.e.Humans are idiots who can't communicate.
Take your pick.