Security forces immediately closed all courthouse doors and detained the defendants, including the former air force and navy chiefs, private NTV television reported. The officers began chanting military songs to protest the court's decision, the TV station reported.
The officers, including several high-ranking generals, are on trial accused of conspiring to topple Prime Minister Recep Tayyip Erdogan's Islamic-oriented government in 2003. All but one officer had been free until Friday's hearing.
The defendants face between 15 and 20 years in prison if convicted on charges of "attempting to topple the government by force."
The case marks the government's increasing confidence in confronting a military that once held sway over Turkish political life. The arrests of high-ranking military officers would once have been unimaginable.
The charges stem from leaked documents published by the Taraf newspaper which prosecutors said were part of an alleged military conspiracy dubbed "Sledgehammer."
The allegations include plans to blow up at least two major mosques during Friday prayers; assassinate some Christian and Jewish leaders; and shoot down a Turkish warplane and blame it on Greece, the country's historic rival. Prosecutors say the conspirators hoped to create chaos which would lead to calls for a military takeover.
The military, which has overthrown three Turkish governments since 1960 and pressured an Islamic-led government to step down in 1997, has denied such a plot, saying documents used as evidence were from a military training seminar during which officers simulated a scenario of internal strife.
Unable to independently assess the evidence, Turks remain divided on the authenticity of the plot and the threat it may have posed.
Those ordered arrested on Friday include retired Gen. Cetin Dogan, former commander of Turkey's first army who chaired the seminar.
The hearing was adjourned until March 14.
The defendants were scheduled to be taken to two prisons in Istanbul on Friday, NTV said. Lawyers for the defendants were expected to appeal the court's decision.
More than 400 people - including academics, journalists, politicians and soldiers - also are on trial on separate charges of plotting to bring down the government. That case is based on a conspiracy by an alleged gang of secular nationalists called "Ergenekon."
Critics say the Sledgehammer and Ergenekon cases are built on flimsy evidence and designed to silence Erdogan's pro-secular opponents. The government denies the cases are politically motivated and says it is just trying to work to improve democracy.