Most rock does not conduct electricity well. It has a high resistivity. But in many places there is quite a bit of water that seeps into the tiny openings, or pores, that are in the rock. Often this water has salts dissolved in it and is a good conductor of electricity. Porous rock that is soaked in salt water will allow electricity to pass fairly easily because the liquid in its pores has low resistivity.
Many factors affect the resistivity of rock.
Rock may be porous, but if there is petroleum or natural gas in the pores rather than water, the resistivity will be high since these hydrocarbons do not conduct electricity well. This is one reason why logging is of interest to people looking for oil. At the right you can see some of the instruments that are lowered into a borehole to measure the electrical characteristics of the ground. These logging tools can be quite large. See how they compare to a person shown standing next to them.