It is OK to stack your mattress while in storage to save space. Some people think standing a mattress upright will save space in storage, but this could potentially ruin your mattress. Keeping your mattress upright could cause springs to break or cause memory foam beds to lose their elasticity.
It's best to lay your mattress on the storage unit's floor and place the heavier mattress on the bottom. Be sure the storage unit is clean before you lay your bed on the ground.