Perhaps it would be nice if we could let foreigners exercise their natural liberty. But in an era of terrorism, America needs to keep its citizens safe from violent Islamist extremists. If we open up our borders, we risk another terrorist attack on the scale of 9/11 or worse.
This is the deeply irrelevant national security argument. It fails almost any conceivable test as a justification for the immigration legislative status quo (or most feasible restrictive alternatives to it).
The 9/11 terrorists, of course, entered the country legally, mostly on temporary visas. If immigration restrictions do not prevent terrorist attacks, then the need to prevent terrorist attacks cannot be a legitimate reason for restricting immigration.
The main immigration restrictions have nothing to do with national security. Instead, current law functions something like a lottery. A fraction of applicants to various categories of residency are admitted by an arbitrary bureaucratic review, or through an actual lottery. These quotas make life miserable for immigrants waiting to live or work in the United States, but they do nothing to prevent actual terrorists from entering the country on temporary or student visas.
In any event, American immigration is predominantly a Latin American phenomenon. Whatever prejudices Americans have about Mexicans, they are rarely suspected of wanting to wage Jihad or establish a new caliphate on American soil. Hysterical Islamophobia is not a reason to keep out Christian Latinos (or Indian Hindus, or Asian Buddhists).
The government would be morally justified in screening out specific people that it reasonably suspected of ties to terrorist organizations. I believe that even this is probably a fool’s errand. The government is not an all-seeing oracle. It is clumsy, inefficient, and operates without any proper incentives. This is one reason why, for example, it is unable to enforce our current immigration restrictions. Conservatives usually understand the impotence of government when it isn’t being used to oppress a disadvantaged minority group. How horrifically intrusive would a government need to be in order to track reliably the potential terrorist activities of the world’s more than 6 billion people? It would have a scope similar to the nightmare state from George Orwell’s 1984.
National security might be an argument for banning any foreigner from ever visiting or immigrating to America. It would be a fairly unhinged argument, but at least a logically coherent one. It might be an argument for screening immigrants for terrorist suspects in a timely fashion. But it isn’t a reason to subject low-skilled Mexicans to a 131 year wait list for an immigrant visa – effectively denying them legal entry to America.