Quick intro.....
Turkey is a fairly new democracy, founded in the 1980's. Originally it was established by Ataturk as a secular, western facing democracy, with the separation of Church and State. Edogan (the current President) was elected Prime Minister about 10 years ago, and proceeded to introduce reforms that restrict civil liberties and bring Islamic laws into general practice. This has been going on now for 10 years, with Edogan being re-elected this year on a base of fear and terrorism (sound familiar?) - there is suspicion that the resumption in Kurdish attacks in the last couple of years was manipulated by Edogan to gain further power. There is also a school of thought that the latest coup was a "Reichstag Fire" arrangement by Edogan or his supporters. Regardless, Edogan will now use the coup to pass further restrictive laws, eliminate (or at minimum reduce the effectiveness of) the political opposition, and establish his own people in the judiciary and military. Basically, Turkey is on the path to become a one-party state, with a dictatorial flavour, that is less western-friendly and plays only lip-service to democracy.
And they are our best Middle-East ally