Why are they being forced to do something about it now? Hasn't it been on the horizon long enough? They have been attacked by ISIS yes because Turkey did nothing for so long?
I'll need to quote myself from the European Politics thread to start off.
"Prior to 2011, the relations between Turkey and Syria were going pretty well. Maybe even too well. Erdoğan would refer to Assad as his "brother", and vice versa. They even took vacations together with their wives. If you were to single out a BFF for Erdoğan, it'd be Assad. Then, out of the blue, the tables turned. Erdoğan, out of nowhere, started calling Assad a dictator who agonized his people. He cut off all diplomatic and economic ties to Syria. What happened? Well, Erdoğan was in the United States to have a meeting with Obama, just days before he started slamming Assad. Overthrowing Assad became an ideal for Turkey as much as it was an ideal for the United States. The reasons were likely economy based, Turkey would probably get something, not clear what exactly, but something to their benefit from the overthrow of Assad. While the Syrian Civil War was going on, Turkey openly started training Free Syrian Army militants. Then, behind the curtains, they started arming the Assad opposers. The Turkish secret intelligence, MIT were accused of sending opposing groups weaponry with trailer trucks. Among those groups being armed were Al Nusra Front, Islamic Front, Ajnad al-Sham Islamic Union and then relatively-unknown to the world, Islamic State of Iraq and Syria. All of these groups have one thing in common: Sunni Islamism.
As the thing in Syria was going on, Erdoğan openly declared his support for the Muslim Brotherhood. He supported Mohammed Morsi in Egypt. During the time of the Egyptian coup d'etat, he started to publicly bash Abdel Fattah el Sisi and became even more fanatical of his statements of support for the Muslim Brotherhood.
Here's the crucial point for all this. Erdoğan, no matter how Pro-Western and non-Islamic he portrayed himself in the past, is a man of his roots. He wasn't going to throw away what he grew up believing in, started doing politics for and strived for. Politics is a game of benefits. It's a clash of pragmatism and ideologies. Erdoğan only did what needed to be done to achieve power and with his new found confidence in the late 2000s, started to push for his ideals. His ideal is to create a complete alliance of the Sunni Muslim world and become the leader of it. He's never been shy of secterianist statements. He wasn't trying to deny it, not trying to hide it. He has made discriminative statements about Alawites and has made sure to single out Sunnis whenever there was a talk of Muslims. When Reyhanlı, Hatay was attacked back in 2013 and 52 people were killed, Erdoğan said "52 of our Sunni citizens have been killed". Speaking of Reyhanlı, it became public through the works of an opposing newspaper that the attack's perpetrators were a group, then allied with Al-Qaeda. That group's name was Islamic State of Iraq and Levant. Erdoğan, or AKP in general never came clear about the accusations.
The truth of the matter is, AKP strived for a Sunni controlled territory in northern Syria that would have substantial benefits to Turkey and push his agenda of "Sunni imperialism" even further. And they thought Islamic State of Iraq and Levant was a possible candidate. That's why they never acknowledged their involvement in Reyhanlı, that's why they stayed away from pushing an operation further. Not because they thought about the risks , as pointed out by myself on this very thread quite a few times before, involving an operation; but simply because they were still hopeful of a Sunni controlled territory to be founded in northern Syria and then becoming their allies.
Assad hasn't been overthrown. United States backed down from their point of view and moved towards a "conversational" approach with Assad. Meanwhile Erdoğan has made it clear that for them to do anything to do with Syria, Assad needed to be overthrown. Now, when U.S. influence was the first thing that made him turn the tables on Assad in the first place, why did he carry on asking for him to be removed? Because that U.S. influence I talked about became crystal clear in the eyes of the general public. People knowing that he wasn't this "world leader who didn't give a shit what anyone else thought" but merely a puppet for a big brother would absolutely destroy the image he had. Therefore he had to go on his way, pretending that he was the one pulling the strings. When in reality everything came clear over time. Erdoğan, with his fanatical Sunni Islamist imperalist viewpoint, his cult of personality that he himself got caught up in, tried to create his own "little brothers" and failed. Immensely. And now the country has to pay for his delusions."
- AKP, while it may be hard to believe, saw ISIS as a possible ally in Northern Syria before they became known worldwide for their atrocities. They'd view Al Nusra Front, Islamic Front or Ajnad al-Sham the same way if they were the ones to find the biggest strength. Turkish secret intelligence sent arms to ISIS via trailer trucks through the Syrian border. They were widely accused of it but there was no evidence. That evidence was found and published on a newspaper by an investigative journalist a couple of months ago. AKP denied helping ISIS and argued they were arming the Turkmens of the area, which in itself is illegal, but it has had a massive effect on their policies regarding ISIS. If AKP didn't take a different approach, they'd be widely exposed as being terrorism supporters, which would effectively end their power.
- A huge part of this whole thing that many foreign followers do not take into account is PKK, PYD and YPG. PKK terror absolutely wrecked this country for years. Hundreds of thousands of soldiers have been killed, thousands of civilians have been killed in terrorist assaults. AKP, under heavy criticism, recognized PKK's leader and started proceedings under the name "Solution Process" which led to a ceasefire. But a resolution was never reached and PKK never agreed to lay down their arms completely. The biggest reason why Turkey could not agree to take on a leading military role against ISIS was their concerns about PKK, PYD and YPG getting stronger in the process. And trust me, it's long known that these groups are looking to take any chance they can to get stronger and establish a seperate Kurdish state. Turkey, obviously not wanting the country to break apart, had to be cautious about their steps, even after they had to recognize ISIS as a terrorist organization. HDP, a Pro-Kurdish party that has ties to PKK but is a force of its own, recently managed to get into the parliament and thus became the forefront leader of the Kurdish cause. PKK, this week, went back to the assaults after couple of years of ceasefire. That's because they want to stay relevant. If Turkey ever backs down from the ISIS fight or struggles to overwhelm them, PKK will get even harsher with their assaults and a war between PKK/PYD/YPG and Turkey will break out on the border. If Turkey deals with ISIS on the border, ISIS will use their militants inside the border and attack the big cities in the country. If Turkey aren't able to deal with ISIS on the border, ISIS will advance into the country. Turkey is facing a threat of having two wars at the same time. They might get rid of one then have another one. The ideal is to have no wars at all.
- What Turkish government should've done was to block foreigners joining ISIS before they could get anywhere near the border, stop the "meddling in" policy in Syria and deal with Assad being at power and making sure ISIS militants wouldn't find anything to their benefit around the border. AKP have failed to fulfill any of these. And since their "potential alligment" came to fail, it now comes to haunt them.
- After AKP nearly came close to being exposed as terrorism supporters, their alligment ideals broke down and PYD/YPG gained strength, they had to strengthen the border and then stop people from joining ISIS. The first time they ever tried to stop people from crossing the border to join ISIS led to ISIS attacking the soldiers, killing one of them and effectively starting the Turkey-ISIS war. Emphasis on the PYG/YPG strength. One of the biggest reasons why AKP has decided to take on a military role against ISIS is because they're scared of PYD/YPG getting even stronger over time. PYD/YPG's armament becomes larger and larger over time due to their alligment with the coalition against ISIS. Turkey pretty much decided to take matters into their own hand because they don't want PYD/YPG to come out on top against ISIS, get stronger, get more motivation and then come fight Turkey over the establishment of a Kurdish state.
Short answer:
AKP decided to stop people from joining ISIS because PYD/YPG is getting the upper hand in Northern Syria and a strong PYD/YPG likely means Turkey facing the danger of breaking apart. And because they started to stop people from joining ISIS, ISIS retaliated. That's why they're forced to act now. Because they can't let PYD/YPG be the "heroes" against ISIS. They have to get down to business, deal with ISIS and make sure PYD/YPG gains nothing from it.
* I hope, for the sake of my time being wasted on here, I've made clear why Turkey cannot (or sadly, couldn't) get into the fight around the borders. Because we'd be facing war. Not that "send your planes to your allies" type of war. A full-fledged war. Maybe not even one, but two full-fledged wars. With one of them having the risk of the country breaking apart. I've explained this time and time again here but to no avail (well, except for Perun who shared the same concerns as I did). People who aren't specificially interested in Kurdish affairs and the area we're talking about will not have a full grasp on the Kurdish interest groups and their goals. I get that. That's why I'm trying to explain stuff. And why this isn't just "Why couldn't Turkey just attack ISIS and get rid of them" thing. That's not how you go about your business in the Middle East. Just ask the United States.