Note that gender is not, in Constitutional case law, in the same tier of protected classes as race and religion (the last two are subject to strict scrutiny, the first to intermediate scrutiny.)
Even where the same justification applies, a distinction that survives intermediate scrutiny may not survive strict scrutiny.