So this keeps happening a lot. I don’t want to bring theology into it, but here’s the verse.
“And if a stranger sojourn with thee in your land, ye shall not do him wrong.” Leviticus 19:33
That’s the most common translation. It also happens to be misleading. The word used in Hebrew is “Ger”.
Ger does not mean stranger. It means resident. One who lives there. You can see that’s true because the same verse uses a variation of the word twice, as is common in the Bible.
In Hebrew that verse reads as וְכִי-יָגוּר אִתְּךָ גֵּר, בְּאַרְצְכֶם–לֹא תוֹנוּ, אֹתוֹ
Phonetically the second, third and fourth words are, Yogur Itha Ger which are translated as “a stranger sojourn with thee”. Yogur and Ger are variations of the same word. Translating one as “sojourn” and the other as “stranger” is clearly wrong.
A consistent translation is “If a sojourner sojourns with you”. Sojourner is not quite right either, but it captures some variations of the term. Within Jewish tradition, the most common usage is Ger Toshav, or Resident Alien. Ger, without any elaboration, is used to refer to converts. (Within Jewish tradition, that verse is generally held to be referring to converts.)
Of course that’s just part of the picture. The full context in the next refers to “for ye were sojourners in the land of Egypt”.
The Jews had entered Egypt with the permission of Pharaoh. They were then abused once they had been legally living there for a long time. They were resident aliens temporarily living in Egypt.
And they said unto Pharaoh: ‘To sojourn in the land are we come; for there is no pasture for thy servants’ flocks; for the famine is sore in the land of Canaan. Now therefore, we pray thee, let thy servants dwell in the land of Goshen.’
The word used for sojourn, again is Logur.
The Bible is not stating that you have to accommodate people who invade your country. It is stating that once you do take in people and they act in good faith, you have to treat them decently. You can’t act like Pharaoh and turn them into slaves or prevent them from leaving.