ANSWER: Let us tackle a quick definition before delving into the Bible. According to Dictionary.com, illegal aliens are people who live in a country, other than the one of their birth, without having obtained citizenship status from the government. In order to find out how aliens (whether illegal or not) should and should not be treated, we need to understand how God instructed ancient Israel to treat the "strangers" (non-Israelites or Gentiles) living with them.
Some erroneously believe that Scripture teaches that ancient Israel was a closed society composed only of the descendants of Jacob. This, however, is simply not true. Not only did God allow aliens (also known as sojourners), whether they are "illegal" or not, to live among his chosen people, he specifically commanded how they were to be treated.
Those born in Israel (as opposed to aliens) were forbidden by God to oppress strangers, especially since at one time they, too, were strangers in a strange land (Exodus 22:21, 23:9). The ancient Israelites were also commanded to apply the SAME laws used for citizens to aliens (illegal or otherwise) as well, "There shall be one law to the one born at home and to the stranger that dwells among you" (Exodus 12:49).
God, no doubt foreshadowing the obedience from the heart that would be required under the New Covenant (Matthew 7:12), also commanded that foreigners not be treated in an illegal (based on his law) manner. They were to be loved as a person loved themselves (Leviticus 19:33 - 34). Those foreign born or aliens who lived in Israel could worship the true God as fully as any native-born citizen.
The Eternal required, with a few exceptions, the same level of obedience from those who were strangers (roughly synonymous to illegal aliens today) as he did from those who were native born or citizens. They could expect to receive the same blessings for obedience, and penalties for disobedience, as any Israelite. For example, strangers were required to keep God's weekly Sabbath day (Exodus 20:10), his annual Feast days (Deuteronomy 16:14, Leviticus 16:29) and offer the appropriate sacrifices (Numbers 15:27 - 29). Like those born in the land, strangers could participate in Israel's sacrificial system and even take part in the red heifer ceremony (Leviticus 17:8 - 9, Numbers 15:14 - 16, 19:10).
The basic difference between born in the land Israelites and aliens (strangers) is that the latter HAD to be circumcised in order to take Passover (Exodus 12:43 - 48). Strangers would also not be automatically released, if they were slaves or bondservants, during the Jubilee year (Exodus 12:43, 45, Leviticus 25:45 - 46).
The treatment of aliens, as found in the Old Testament, was carried over into New Testament times when God's blessings would be available to people of all nations. The leaders who gathered for what is referred to as "the Jerusalem conference" (see Acts 15), understood this profound truth. They did not place on Gentile (non-Israelite) believers any greater responsibility than what God's law required. What does all this mean, however, for us today, especially for those living in countries like the United States that are struggling to deal with a growing influx of "strangers" from other countries?
Those living in a country should not mistreat illegal aliens that live among them. However, just as sojourners in Israel were required to obey God's laws before receiving his blessings, the strangers among us should also be required to obey the laws of the land before receiving the same benefits and privileges that come to citizens. If God's commands regarding these people were observed by governments, they would avoid many of the problems they currently experience.