According to the prosecutor’s office, it's because they're accused of having links to the network of US-based cleric Fethullah Gulen.
Ankara says it was him who orchestrated a 2016 attempted coup.
Those who are facing jailtime include three colonels, eight majors and 10 lieutenants.

Russia pounds Kyiv with missiles, killing at least nine
Trump says deal reached to disarm Hamas, Israeli support for plan remains uncertain
Kuwait intercepts new wave of Iranian attacks
India's Modi says punishing student protesters will not resolve situation
