Under regulations prescribed by the Secretary, any enlisted member may be discharged at any time within three months before the expiration of his term of enlistment or extended enlistment without prejudice to any right, privilege, or benefit that he would have received, except pay and allowances for the unexpired period not served, or to which he would thereafter become entitled, had he served his full term of enlistment or extended enlistment.