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.
But that only works
if god exists - a claim that is devoid of evidence.
If there is no god then this assertion merely means that the Israelites didn't like the treatment they received from the Egyptians (not unreasonable), were able to escape to Palestine and declared that that land belongs to them (but as so often happens with religious sects, claimed their right to the land didn't emanate from themselves but from 'god', for which there is no evidence).
Having done that the Israelites determined that they should be able to have slaves, probably reflecting the treatment they'd received by thinking they should be able to dish it out as well as receive it. Again claiming this to be god's will - see earlier point on existence of god.
So all this amounts to is the classic mantra of: 'oh look, we are special in the eyes of god, he want is to have this land, he agrees we should be able to have slaves' etc etc. Same old, same old - trotted out by religious groups the world over through the centuries.