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.

Hurricane Melissa hits Cuba hours after devastating Jamaica
Trump says Gaza ceasefire holds, Israel has right to hit back if attacked
South Korea welcomes Trump with its highest award, a golden crown and ketchup
Ex-Philippines president Duterte appeals ICC jurisdiction ruling
Cyclone Montha lashes India's east coast; kills one
