Warning: the below is very imprecise. I'm going to be talking about "Europe" as if it's a single entity. It's clearly not. There are a dozen different levels of integration, with groups defined along dimensions of politics, economics, and travel.
Throwing NATO into the mix makes things even more complicated, since it's a military alliance that largely but not completely overlaps the EU. (Blue is EU, orange is NATO, purple is both.)
Here, though, I'm going to talk about Europe as if it's an entity capable of making unified decisions along all these lines. Because my argument depends on that, it is also an argument for greater European integration.
Europe is in an interesting position in the world right now. By any economic standard, it is a superpower: its GDP exceeds that of the United States, and its GDP per capita is quite high as well. But its military spending is only 1.55% of GDP, compared to the United States 3-3.5%. Europe clearly has the capability to be a military powerhouse, and chooses not to do so.
Why they've made this collective choice is largely a matter of history. The last two times there were major military buildups in Europe, large fractions of the population died. Since World War 2, European defense has been guaranteed by NATO, meaning the United States. (Well, and the Warsaw Pact for a while there.) Since the end of the Cold War, there's been no perceived need for Europe to defend itself. They've been unthreatened, able to spend their money on things like education and health care and social programs. More power to them in that regard.
But Europe doesn't have the geographic luxury of playing the isolationist, when 80% of the world's population can walk there. South Sudan and Somalia have been disasters for decades. When Syria disintegrated, the problem got ten times worse. There are a finite number of refugees Europe can absorb, and they're reaching that point rapidly.
Europe can not afford to continue playing such a passive role in the world. When a country like Lybia or Syria collapses, it is now everybody's problem, at least everybody who doesn't have an ocean between them and the catastrophe. Consequently, Europe must help to prevent and overcome such destabilizations. We must put in place a process to deal with failed states, rather than ignoring the problem.
Put another way, which is cheaper: absorbing half a million migrants? Or sending twenty thousand troops to occupy and stabilize Syria?
Yes, I'm an American. Iraq and Syria and Afghanistan were destabilized by the actions of my government, directly leading to this migrant crisis that Europe and Turkey are now forced to handle. But fault is irrelevant when discussing solutions. This migrant crisis will not stop. If it hadn't been caused by this, it would have been something else.
From a certain perspective, being overrun with refugees or economic
migrants is no different than being threatened by an external military:
you have nice things, other people want them, and they'll come take them
if it's cost-effective to do so. The only way Europe can prevent being peacefully plundered, today or tomorrow, is to actively reach beyond its borders to keep the world more stable.
I speak of Europe, but the same can be said for Turkey. Turkey's
military is formidable, but they've absorbed millions of refugees rather
than use their military to stabilize Syria. I suspect this is due to
balance of power issues between them and the other two major players in
the region, Saudi Arabia and Iran.
For that matter, the same can be said for the United States and immigration from Latin America. The best way to prevent illegal immigration is to make Mexico and Central America safe places to live and work.
Major powers in the world go to great lengths to avoid being perceived as imperialist. Colonialism in the past has led to tremendous harm (see the existence of Syria and Iraq). But in a world of failed states, especially a world as connected as ours has become, a new kind of colonialism may be the most cost-effective solution for all involved.