When drilling oil and gas wells, a substantial amount water is used for drilling fluid (water-based mud). Bentonite, a naturally occurring sodium-clay, is added to the drilling fluid. The main functions of drilling fluid include providing hydrostatic pressure to prevent formation fluids from entering into the well bore, keeping the drill bit cool and clean during drilling, carrying drill cuttings out of the well, and suspending drill cuttings while drilling is paused and when the drilling assembly is brought in and out of the hole.
After drilling, the drilling fluid was considered wastewater. In Australia, I implemented a project where drilling fluid was purified using mechanical separation methods (centrifugation, flotation, sedimentation, and filtration) and could then be re-used for the next well.
And when producing oil or gas from a well, also water is produced. In the past this water was treated as waste water. But for countries where water is scarce, this production water could be purified and re-used. In Oman I implemented a project where water-production from oil wells was purified with a reed filter. The clean water was used for irrigation, and the reeds as camelfood. By filtering the prodution water, over 5000 m3 of wastewater per day could be re-used for irrigation.