Did they have a closet? Some sort of armoire? a whole separate room?
I assume you're asking about Europe?
The answer is chests, mostly. Chests and cabinets of various sizes, up to what we'd consider a wardrobe. In general, the size got bigger as time went on.
For most of the Middle Ages, many royal courts were itinerant. That is, the monarch and their household didn't stay put in one place, but moved every few weeks or so. They'd stay at various royal castles scattered across the landscape, or at the home of some favored lord. This constant movement meant that the household had to be easily packable and transportable. Chests are good for that.
As time went on, and the getting in to the Late Medieval and Renaissance, the courts started to settle down. Castles gave way to palaces and stately homes. with a more sedentary court, storage chests could get larger, and by the 15th century we start getting large wardrobes.
Eventually, Queen Elizabeth I had an entire building with an entire staff devoted to storing her immense clothing collection.
Here's another answer from a couple years ago by /u/gggggrrrrrrrrr for someone else with a very similar question.