The Turkish President was correct in warning the constitutional court that releasing the newspaper editors would lead to undermining the safety of the Turkish people. While the President's warning may not prove true, the fact that it was stated itself serves as a warning to the Turkish people. Also, in order for the courts to keep neutral, it cannot opine one way or other; the President was able to do that in the court's stead. A win-win situation.
Releasing the newspaper editors would not lead to jeopardizing the safety of the Turkish people in general. If conditions in this area of Turkey are less than ideal, others need to know. If anything, I would think that the Turkish government would be quick to better the conditions if they do not want criticism from others for conditions being exposed by journalists.
The constitutional court acted correctly in accordance to the law. Erdogan's claim that this will harm the security of the nation is spurious and guided by his desire to have a completely acquiescent press that only prints material that is favourable to him and his administration. His remarks should be viewed in the context of years of press repression.
The president of Turkey is using strong arm techniques to try to control the free flow of information to the people. He is using excuses about the constitution court to justify a repressive attempt to limit free speech. They are journalists, not spies, and have a responsibility to report on the conditions in their country.