Each person discharged from the armed forces who is later charged with having fraudulently obtained his discharge is, subject to
section 843 of this title (article 43), subject to trial by court-martial on that charge and is after apprehension subject to this chapter while in the custody of the armed forces for that trial. Upon conviction of that charge he is subject to trial by court-martial for all offenses under this chapter committed before the fraudulent discharge.