In Deuteronomy 10 Moses is preaching to Israel. In his sermon text Moses reminds Israel that the LORD God of Israel executes justice for the orphan, widow and loves the resident foreigner, giving him food and clothing (v. 18). Then Moses commands every Israelite to love the resident foreigner because there was a day, in the not so distant past, when the Jew he was speaking to or his parents were resident foreigners in Egypt. A resident foreigner is an immigrant. The Jews migrated to Egypt because of a famine.
Now we can have the conversation concerning the reality that Israel did not enter Egypt illegally but instead received Pharaoh’s blessing to enter the land. However, the point of the text is not legal or illegal immigrant. The point of the text (Deut. 10:18) is God loves and cares for immigrants like he loves and cares for widows and orphans and so should I!