The measure could spark a legal battle between the administration and states that adopted gender identity protections.