Most any nation will face the situation of people who want to enter its territory. It will need some sort of policy towards immigration.
To understand the government's role in immigration, it is helpful to first consider the situation without government. How does immigration work in the case of private property? Quite simply, it is occurs only if the property owner wants it. Having property rights means having the right to allow and restrict the use of the property to whatever people the owner chooses. If someone other than the owner attempts to use the property, the owner can prevent him from doing so.
Since the owner can choose whom to allow onto his property, he will naturally tend to allow those who best comport with his own interests. That is, they will usually be people that he likes and gets along with, or those who advance his economic prosperity.
But what about government-owned property? Government did not get its property from nowhere. Its property has been purchased, maintained, and improved using money taken from taxpayers. Whether or not this taxation is legitimate, it is the taxpayers who have a legitimate claim to the use of this property, since it is their money that has been used to pay for it.
Thus the taxpayers can decide how to use this property, and who to allow or not allow on it. They can decide this through the democratic process. While this is a far from perfect means of making decisions, it is the best available as long as the property is owned by the government.
The supposition that everyone has a right to use government-owned property is wrong. If a policy of unrestricted use of government property is adopted, then everyone will receive a benefit that only some people will pay for. Thus adopting this policy will increase the costs to taxpayers for maintenance while limiting their ability to use what they have paid for.
This means that adopting a policy of "open borders", allowing unrestricted access to government-owned roads, parks, and forests, would not increase freedom. Rather, it would decrease freedom and increase the exploitation of taxpayers.
The costs to taxpayers are exacerbated even further if a country has welfare programs that are not restricted to citizens. These can include public schools, emergency medical care, police services, and other government benefits. Providing these services to non-citizens will encourage immigration, whether legal or illegal, and costs taxpayers even more money. While eliminating such incentives may be ideal, but limiting immigration may still be the best policy to protect freedom in the mean time.
Immigration also has costs for a society. Immigrants may commit crimes at different rates than citizens of a country. The may cause car crashes at different rates than citizens. They may unintentionally bring diseases that are common in their homelands, but uncommon elsewhere. Some proportion of them may engage in terrorism or promote radical ideologies. All of these costs are not borne by those who promote immigration, but are borne by all of society.
Immigration can also cause cultural conflict. People from significantly different cultures will tend to distrust each other. This can easily lead to strife. Also, it will often lead to political conflict, with different groups seeking government benefits and advantages over others.
Emigration, or leaving a country, is also often not a product of the free market. Why would someone leave behind family, country, and everything familiar and move to a foreign land? Usually, it is extreme poverty, hunger, and lack of freedom. But these would not exist in the modern world without oppressive government. Thus immigration depends not only on the government policies of the country receiving immigrants, but on the government policies of foreign countries as well.
Some governments may actively encourage emigration to get rid of politically troublesome or economically unproductive subjects. Others may encourage subjects to settle in other countries to obtain greater influence over their politics, as Russia did in eastern Europe, and Mexico is doing in America.
Taking in these immigrants relieves political dissent and economic pressures in those foreign countries. It thus discourages political reforms that would allow prosperity in these countries. A loose immigration policy can be seen as a subsidy to corrupt foreign governments.
Any country is defined by some geographical region with borders. For the reasons given above, a country must be able to defend its borders and stop unauthorized people from using private and government property. This might require guards, fences, or other such measures.
This does not mean that all immigration is bad. Some immigration can be beneficial. But how should a society decide which immigrants to admit and which to reject?
Just as private individuals will admit those they like, society should admit those who are culturally similar, who can assimilate easily or those who have desirable cultural traits. Thus a good immigration policy would favor those who speak the native language, understand society, and hold similar values.
Just as private individuals admit those who benefit them economically, society should admit those who are educated, have a good work ethic, and will start businesses. However, admitting low-skilled workers will only benefit some while hurting many others.
Some immigrants will enter or stay in a society illegally. For all the reasons above, they must be deported to their home countries. Enforcing immigration laws will create a disincentive to breaking them. If there are many illegal aliens in a country, enforcing the law and deporting a few will encourage many more to leave on their own.
Because people differ, immigration can be both beneficial and harmful. Some levels may be beneficial and others harmful. A nation's immigration policy should protect the property rights of taxpayers and admit only those who benefit society.