I am guessing that Rowling would have never considered that. They would probably have to stay in the dorms that match up with the genders on their birth certificates or something :(
^exactly what I had in mind. It would apply for the people who aren't either male or female as knowing J.K. she probably never considered what would happen in that case