On average, the expected lifespan of an open bag of potting soil is about 6 months. That number could decrease considerably if you don't store it properly. Unopened bags can keep potting soil in good condition for a year or two. Miracle Grow's unopened potting soil bags, kept under proper storage conditions, should be kept for five years or more.
As long as the bag remains dry, the fertilizer will not be able to release the nutrients. Open potting soil bags usually maintain their highest quality for about 6 months to a year. Things like air and excessive moisture can reach the soil inside and begin to break down nutrients and compress the soil at a faster rate than soil that doesn't open for months before use. Potting soil generally doesn't expire.
However, after about 6 months to a year, the soil mixture will begin to lose its nutritional potency. It won't be completely unusable, however, it won't benefit your plants as much. Potting soil is best stored when stored in a container with a lid, away from sources of heat and high humidity. Close the top of the original bag and secure it, then place it in a galvanized can or plastic bin.
The storage container should be kept away from rain and direct sunlight to limit bacterial growth in the soil.