I think it should be the other way around, that no one who served in the military should be eligible at all for president.
Why?
Because the military is inherently a dictatorship that ignores individual rights and strictly follows the edicts of a hierarchy.
That may be necessary for the military, but is totally and completely contradictory to a democratic republic, and also is extremely susceptible to corruption.
It is much like a monarchy, the very thing all citizens of a democratic republic should fear and hate.