Sexuality or sexual orientation is covered under the Equality Act, perhaps the judge needed direction, as they often do in my experience.
I am not absolutely clear that the decision was the judge's - I think the decision might have been that of the rehabilitation programme.
Either way, I don't think it was a case of someone illegally saying "you're not heterosexual and therefore can't enter the programme".
I think it was rather a case of someone saying, the programme is for male abusers plus female victims - and your partner no longer identifies as female - therefore you can't enter the programme.
I don't think it is necessarily illegal for the programme to cater solely to a combination of male abusers and female victims? (The problem here isn't that, but rather the fact that the victim was incorrectly judged to be nonfemale.) But if it is illegal then I'm not sure whether the judge could have used this case to make an order against the programme or whether a separate legal case against the programme would need to be brought.