This is a loaded question and very difficult to answer. I assume that you are talking about illegal immigrants. To curb illegal immigration nations can do many things. As to the effectiveness, this is a harder point to determine.
First, nations can pass laws that forbid illegal immigration. This is a start, even if this law is difficult to enforce. It would also be more effective if these laws are reciprocated in other nations as well. The basis of law, we can say, is foundational.
Second, there needs to be enough border patrol and law enforcement. There is no way around it. There needs to be people to actually do the work of patrolling.