For the destination weddings I’ve been invited to/involved in, my experience has been that generally it’s up to the guest to reserve a room and pay for it. If the wedding organizers have a lot of people coming, they might arrange with the hotel for a group discount for their guests (much like a conference/convention does).
It’d be hella expensive for the couple getting married to set up rooms for the guests, so assigning guests rooms seems pretty odd. But then again, Sherlock did a very thorough job of planning this wedding. Of course, he didn’t remember what room Sholto was in, so maybe they weren’t assigned. Maybe Sholto had just mentioned to John and Mary earlier which room he’d be staying in. (He would have wanted a chance to spend some time with John, I would imagine. The whole plot hinges on this wedding being the only thing that can roust Sholto from his self-imposed exile, so clearly John is extremely important to him.)
And he probably did need a room. I doubt he was traveling from wherever he lives to the hotel in his dress uniform. He’d have needed someplace to change and tidy up. Also it looks like the reception was running pretty late, so he was probably expecting to stay the night and leave in the morning.