A regular enlisted member who is selected to be involuntarily separated, or whose term of enlistment expires and who is denied reenlistment, and who on the date on which the member is to be discharged is within two years of qualifying for retirement under section 7314 or 9314 of this title, or of qualifying for transfer to the Fleet Reserve or Fleet Marine Corps Reserve under
section 8330 of this title, shall be retained on active duty until the member is qualified for retirement or transfer to the Fleet Reserve or Fleet Marine Corps Reserve, as the case may be, unless the member is sooner retired or discharged under any other provision of law.