Porosity is the property of an object that expresses the total volume of empty or pore space in the material. For rocks that contain hydrocarbon resources this is a measure of the percentage of the total rock which is occupied by pore space. A porous rock contains a large number of tiny spaces in it that are able to hold oil or natural gas (or even underground water).
If an object is porous, it has a great ability to hold fluid within itself. Sponges, wood, rubber, and some rocks are porous materials whereas marble, glass, and some plastics are not porous and contain very few open pockets of air (or pores).
Porosity is an important characteristic for a rock to have if it is to make for a good rock for an oil well. Generally speaking, 8% is the minimum porosity required to make a good oil well, although some wells are completed with less porosity. When oil or gas is exposed to a porous rock, they will seep into the holes in the rock and be contained between the grains. Because of this, there is actually no "ocean of oil" beneath ground, rather it is trapped within porous rocks such as sandstone. Reservoir rocks all have a relatively high porosity.