10 USC 634 - Retirement for years of service: regular colonels and Navy captains

(a) 30 Years of Active Commissioned Service.— 
Except as provided in subsection (b) and as provided under section 637 (b) of this title, each officer of the Regular Army, Regular Air Force, or Regular Marine Corps who holds the regular grade of colonel, and each officer of the Regular Navy who holds the regular grade of captain, who is not on a list of officers recommended for promotion to the regular grade of brigadier general or rear admiral (lower half), respectively, shall, if not earlier retired, be retired on the first day of the month after the month in which he completes 30 years of active commissioned service.
(b) Exceptions.— 
Subsection (a) does not apply to the following:
(1) An officer of the Navy who is designated for limited duty to whom section 6383 (a)(4) of this title applies.
(2) An officer of the Navy or Marine Corps who is a permanent professor at the United States Naval Academy.