Bed frames and mattresses are not cheap, so if you have one you won't be using for a while, it often makes sense to put it in storage until you need it again rather than throwing it away or donating it. But you need to be careful to store your bed properly if you don't want it growing mold, to be smelly, or to become warped in the storage unit.
Choose climate control.
Especially for the mattress, climate-controlled storage is essential. It's not so much the changes in temperature you're worried about in an outdoor unit, but rather the changes in humidity. A single humid day could cause your mattress to mold, and then it will be ruined forever. Humidity, like temperature, is kept quite constant in a climate-controlled facility.
Clean it thoroughly.
If there are any mold spores or dead skin cells on your mattress when you put it in storage, it's more likely to emerge smelly. So put the wand attachment on your vacuum, and spend some time vacuuming every surface of your mattress. If there are any stains, treat them with an enzymatic cleaner, which will break down the proteins in those stains so they don't smell any more. Let the mattress dry completely (for a day or more) before putting it in storage. Wipe the bed frame down with some soapy water and also let it dry.
Cover it in sheets.
You do not want to encase the mattress in non-breathable plastic. This will just trap moisture and bacteria inside, possibly leading to odors. Instead, wrap it with some clean sheets, which will keep dust off of it while still letting it breath. You can do the same for the bed frame. Secure the sheets by tying a rope around them, if needed.
Store the mattress flat.
Many people try to store their mattresses on their sides to save space, but over time, this can cause the mattress to bend. It won't be comfortable with a big bend in the middle! Always set the mattress flat on top of some pallets or short shelves. You could also just reassemble the frame in the storage unit and store the mattress on top of it. Don't store anything too heavy on top of the bed, as these items may create an impression. Light things like linens and towels can be safely stored on the mattress if you're short on space.