In an address to the nation on Friday night, he said: "Turkey can only solve its issues by showing the courage to face its problems.
"An impaired democracy is not the fate of this country. No one is above the law, no one is untouchable, no one is privileged."
Erdogan's speech came as the state-run Anatolian news agency said Cetin Dogan, a retired general who once headed the Istanbul-based First Army, and Lieutenant-General Engin Alan, a former special forces commander, were formally arrested on Friday after appearing at an Istanbul court.
Dogan had occupied a position traditionally seen as a step towards becoming head of the Turkish armed forces.
Alan led a successful operation to bring captured Abdullah Ocalan, the Kurdish separatist leader, back to Turkey, according to Turkish media.
Three detained retired officers - Ibrahim Firtina, a retired air force commander; Ozden Ornek, a former navy chief; and Ergin Saygun, a former deputy chief of general staff - have been released.
However, reports indicate that police have detained 17 more serving military officers and one retired officer in an operation stretching across the country.
All suspects have reportedly denied the allegations, which include plotting to blow up mosques and kill some non-Muslim figures to foment chaos and trigger a military takeover.
The evidence - in the form of recordings published on leading websites- were allegedly conversations between ranking commanders at a military unit under Dogan's command in Istanbul.
Operation Sledgehammer is said to have been drawn up and discussed in 2003 within the First Army, shortly after the AK party came to power.
It was not known whether the suspects made any move to activate the alleged plan, first reported in January by the Taraf newspaper.
Erdogan's party, which denies accusations it has a secret Islamist agenda, is banking on an economic recovery after last year's deep recession to win over voters in advance of an election due early next year.
In 2008, the AK party narrowly escaped being banned for violating Turkey's secular system.
With the government threatening constitutional changes to overhaul the judiciary, there is speculation that Turkey's chief prosecutor could make a renewed attempt to ban the AK party.
Anita McNaught, Al Jazeera's correspondent in Istanbul, said: "None of the institutions in Turkey have complete public confidence on their own, but it was seen that there was a balance between them - they checked each other's excesses.
"So you have the judiciary, in tension with the government, but also with the military, which is in tension with the government and between the three, Turkey reached a kind of equilibrium.
"The concern is now that things are getting a little out of balance and that too much power will end up being consolidated in the hands of one of the other actors. And that, in a broader sense, is what is concerning people here."