The electrolyzers used to produce hydrogen from electricity and water need very pure water and typically start with city-quality water, but need to further purify it. Membraneless (e.g., alkaline) electrolyzer technologies may be more accommodating of impurities. Water is rejected in the purification process amounting to half to two-thirds of the water “consumed” in the process. It typically takes roughly 10 liters of water to make a kilogram of hydrogen.
The rejection water is clean enough to use for agricultural purposes, as purification does not add impurities to the inlet water. The one-third to one-half of the water that is split to release hydrogen could theoretically be collected in fuel cell applications where the hydrogen is reconstituted as pure water. Keep in mind that each kilogram of hydrogen (with roughly the energy equivalence to a gallon of gasoline) will produce nine kilograms of water once consumed, so recovery may often be difficult or infeasible.
See: Life-Cycle Analysis of Water Consumption for Hydrogen Productions, Elowiny, Lampert, et al, Argonne National Laboratory, June 2015.