The court’s ultraconservative majority seemed unswayed by arguments in support of two transgender teenage girls.