The case could have wider repercussions for transgender people and affect whether other measures targeting them in the public sphere.