10 U.S.C. § 631 : US Code - Section 631: Effect of failure of selection for promotion: first lieutenants and lieutenants (junior grade)

      (a) Except an officer of the Navy and Marine Corps who is an
    officer designated for limited duty (to whom section 5596(e) or
    6383 of this title applies), each officer of the Army, Air Force,
    or Marine Corps on the active-duty list who holds the grade of
    first lieutenant and has failed of selection for promotion to the
    grade of captain for the second time, and each officer of the Navy
    on the active-duty list who holds the grade of lieutenant (junior
    grade) and has failed of selection for promotion to the grade of
    lieutenant for the second time, whose name is not on a list of
    officers recommended for promotion to the next higher grade shall -
    
        (1) be discharged on the date requested by him and approved by
      the Secretary of the military department concerned, which date
      shall be not later than the first day of the seventh calendar
      month beginning after the month in which the President approves
      the report of the board which considered him for the second time;
        (2) if he is eligible for retirement under any provision of
      law, be retired under that law on the date requested by him and
      approved by the Secretary concerned, which date shall be not
      later than the first day of the seventh calendar month beginning
      after the month in which the President approves the report of the
      board which considered him for the second time; or
        (3) if on the date on which he is to be discharged under
      paragraph (1) he is within two years of qualifying for retirement
      under section 3911, 6323, or 8911 of this title, be retained on
      active duty until he is qualified for retirement and then be
      retired under that section, unless he is sooner retired or
      discharged under another provision of law.

      (b) The retirement or discharge of an officer pursuant to this
    section shall be considered to be an involuntary retirement or
    discharge for purposes of any other provision of law.
      (c) An officer who is subject to discharge under subsection
    (a)(1) is not eligible for further consideration for promotion.
      (d) For the purposes of this chapter, an officer of the Army, Air
    Force, or Marine Corps who holds the grade of first lieutenant, and
    an officer of the Navy who holds the grade of lieutenant (junior
    grade), shall be treated as having failed of selection for
    promotion if the Secretary of the military department concerned
    determines that the officer would be eligible for consideration for
    promotion to the next higher grade by a selection board convened
    under section 611(a) of this title if such a board were convened
    but is not fully qualified for promotion when recommending for
    promotion under section 624(a)(3) of this title all fully qualified
    officers of the officer's armed force in such grade who would be
    eligible for such consideration.