ANSWER: Illegal aliens are people who enter into and live in a country who are not considered citizens. These people are called aliens because they were born in a country different from the one they are trying to enter or which they currently reside in. They are considered illegal because the government of the country they are entering or residing in has not officially granted them permission to enter or stay in their territory.
In order to find out how illegal aliens should and should not be treated, we need to understand how God instructed ancient Israel to treat the "strangers" (also known as foreigners, Gentiles, sojourners, etc.) living with them. It is not true that Israel was a closed society composed only of the descendants of Jacob. Not only did God allow aliens, 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 were forbidden, by God, to oppress or otherwise mistreat strangers (whom we would refer to as aliens). This was because the Israelites, at one time, were also strangers in the strange land of Egypt (Exodus 22:21, 23:9). They were 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), commanded that foreigners 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 (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 native Israelites and aliens whom humans considered illegal were 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 the New Testament when God's blessings would be available to all people. 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 of everyone. What does all this mean, however, for those struggling to determine how handle illegal aliens either attempting to enter their country or who live among them.
Those living in a country should not mistreat illegal aliens but rather treat them with love and mercy. Those who resided in Israel, regardless of where they were born, were required to obey God's laws before receiving his blessings. It is therefore reasonable for governments to require obedience to their laws before they offer such people the exact same benefits as citizens.