The Turkish military sees itself as the guardian of the Kemalist constitution and is unhappy with Erdogan.
See http://en.wikipedia.org/wiki/1980_Turkish_coup_d%27%C3%A9tat
Rising conflicts between popular groups would, if they seriously undermined Erdogan's claim to be in command of the country, provide a pretext for a coup.