A capitalist country warmly welcomes all rights respecting individuals regardless of color, religion, sex, nationality, creed, race, etc. The sentiment is expressed in “The New Colossus” a sonnet by American poet Emma Lazarus inscribed on the statue of liberty:
“Give me your tired, your poor,
Your huddled masses yearning to breathe free,
The wretched refuse of your teeming shore.
Send these, the homeless, tempest-tost to me,
I lift my lamp beside the golden door!”
Under capitalism, where the right to defense is delegated to the government, it is the government’s responsibility to prevent the entrance of terrorists and other rights-violating individuals from entering the country by securing the nation’s borders — similar in principle to how one secures their house and property. The implementation of this principle depends on many factors in a given context (which can change over time). The immigration policies of a nation-state under war would be different from one at peace. The immigration policies towards a citizen of a capitalist country (i.e., we have a valid criminal record from a foreign government we trust) would be different than to a citizen from a communist/socialist/theocratic one (i.e., is the immigrant a spy or a political refugee?).
Under capitalism immigration is an asset, as the human mind is the ultimate resource: the more people, the larger the market, the greater the possibilities for the division of labor. The larger the population in a capitalist country, the more specialization is possible, and the greater the benefits from the division of labor (see Immigration and Individual Rights and Immigration Quotas vs. Individual Rights. Note that a later revised version of the second article, published elsewhere, advocates ‘open borders’ — essentially no borders — which this site does not agree with). Contrast this to socialism, tribalism, and other forms of collectivism, where every additional mouth to feed is a drain on the welfare state’s dwindling resources and ever-shrinking pie (see Immigration and The Welfare State). The immigration of people into a capitalist country is not a drain on a government’s fiscal budget (and by extension taxpayers), as it is in the American welfare state of today, as there is no government welfare in a capitalist society (only private charity).
Similarly, in regards to emigration, a rights-respecting individual is also not prevented from leaving a country (so long as their emigration is not resulting in the violation of the rights of others, or illegally interfering with the government’s ability to protect rights, i.e., smuggling stolen goods outside the country). Generally, it is communist states — like the former Soviet bloc East Germany and Castro’s Cuba — that have to build walls, not to prevent invaders from entering, insomuch as to prevent “masses yearning to breathe free” from leaving these prison states.