Judge sentences veteran to 24 hours in jail, then joins him behind bars