This is done all the time if you race --- might have a set of wheels for different conditions plus a set of time trial wheels
TT wheels will have a tighter cassette generally but normally not much to ever have to fuss over. I used to race track - ditto there - had multiple sets of wheels. Spoked trainers, race wheels, discs, 3 spokes, 5 spokes etc etc
I have a burly set of Enduro spec wheels on my mountain bike for durability reasons , but id like to try a speedier set of XC wheels --- seems like the same principle - just have to have the same size disc rotors, rear spacing and a cassette in a similar dimension to your current one --- a chain and rear derailleur optimized to run with a 11-46 might not play nice with a 10-51 for instance
But alas , in the end it seems like a lot to futz with so i havent done it