I borrowed this from The Engine Oil Bible:
In general, liquid lubricants (ie. oils, not greases) will remain intact for a number of years. The main factor affecting the life of the oil is the storage condition for the products. Exposure to extreme temperature changes, and moisture will reduce the shelf life of the lubricants. ie. don't leave in the sun with the lid off. Best to keep them sealed and unopened.
Technically, engine oils have shelf lives of four to five years. However, as years pass, unused engine oils can become obsolete and fail to meet the technical requirements of current engines. The specs get updated regularly based on new scientific testing procedures and engine requirements. But this is only really a concern if you've bought a brand new car but have engine oil you bought for the previous car. An oil that is a number of years old might not be formulated to meet the requirements set for your newer engine.
If your unopened containers of engine oil are more than three years old, read the labels to make sure they meet the latest industry standards. If they do meet the current standards, you might want to take the extra precaution of obtaining oil analysis before using them. An oil analysis will check for key properties of the oil and ensure that it still meets the original manufacturing specs. Of course the cost of getting an analysis done on old oil is probably going to outweigh going and buying fresh stuff. So it's a double-edged sword.
As a general rule, the simpler the oil formulation, the longer the shelf life. The following is a guideline under protected conditions:
Product Shelf Life
Base Oils, Process Oils 3 years
Hydraulic Oils, Compressor Oils, General Purpose Lubricating Oils 2 years
Engine Oils and Transmission Oils 3 years
Industrial and Automotive Gear Oils 2 years
Metal Working and Cutting Oils 1 year