Water in our environment contains minerals, sediment, organic compounds, and pollutants just to name a few. So water is not typically pure H2O, which we don't want it to be anyway. Those minerals in water help our bodily functions. However, we could do without the other "stuff." Soils have properties that allow them to capture certain elements and compounds from the water that flows through them. Many soils tend to be negatively charged. Think of a battery having a positive and negative terminal now apply that to the concept of a magnet where like repels like and opposites attract. The positively charged molecules flowing in the water are attracted to the negatively charged soil. Soil can then hold on to these compounds while the water flows through with a few less friends tagging along for the ride.
Some of the compounds that stick or do not fully travel through the soil to the groundwater can be decomposed (changed into a less harmful form) by the soil microorganisms. This is especially important for septic systems where waste and human borne pathogens enter the soil. Assuming a proper soil type (drains not too slow or too fast), the microbes have a chance to attack these organisms and breakdown the waste before it enters the groundwater. Similar filtering in conjunction with bacteria and other microbes occurs in wetlands. The bacteria have special skills that allow them to degrade the pollutants into less harmful forms. There are even soil bacteria that can break down nuclear waste!
|Soil bacterium found to break down nuclear waste. http://www.sciencedaily.com/releases/2014/09/140909093659.htm|
However, just as any system, soil does have its limits. Overloading this resource with too many constituents, compounds that harm these important soil microbes involved in chemical degredation, or chemicals that flow through the soil and into the groundwater without filtering can have devastating effects on water quality. With that in mind, yes soils are a powerful filter, but we have to be responsible about what throw at it.