10 USC 1161 - Commissioned officers: limitations on dismissal

(a) No commissioned officer may be dismissed from any armed force except
(1) by sentence of a general court-martial;
(2) in commutation of a sentence of a general court-martial; or
(3) in time of war, by order of the President.
(b) The President may drop from the rolls of any armed force any commissioned officer
(1)  who has been absent without authority for at least three months,
(2)  who may be separated under section 1167 of this title by reason of a sentence to confinement adjudged by a court-martial, or
(3)  who is sentenced to confinement in a Federal or State penitentiary or correctional institution after having been found guilty of an offense by a court other than a court-martial or other military court, and whose sentence has become final.