A capitalist country secures its borders just like an individual secures their property: borders are closed to rights-violating individuals, and open to rights-respecting individuals.
The difference between a country that secures its borders and an individual that secures their home is that under capitalism a private individual can close or open their home/business to whomever they wish, whereas the government is only permitted to close off migration to rights-violating individuals.
What immigration policy a country follows — the degree of security that is implemented — depends on the context, i.e., one’s neighbors and neighborhood.