With the bike on the center stand the shocks are fully extended.
If you remove both of them at the same time, the rear swing arm and wheel will drop down to hit the ground so don't do that.
Remove one side only and install that side of the rack.
Once the rack is in place reinstall the shock mount on that side.
Then, remove the shock on the other side.
You may have to spring the new rack a bit to get it in place but it shouldn't be too hard to do.
The other option is to put a block under the rear wheel so it won't drop. Then you can remove both shocks at one time.