Groundwater quality in the towns of Namakkal and Erumaipatti in India was studied to understand the nexus between surface sanitation and groundwater quality in hard rock regions. In total, 32 wells, both shallow open and deep bore wells, were monitored over a two-year period. The presence of fecal coliforms (FCs) up to 600 CFU/100 mL in wells as deep as 100 m showed that bacteriological contamination had reached deep aquifers through fractures and fissures. Statistical analyses showed that bore wells located in Namakkal were bacteriologically more contaminated than those in Erumaipatti (p = 0.017 for FC) because of urbanization, the type of top soil and the shallow groundwater table. Wells in densely toileted areas of Namakkal were more contaminated than those located in open defecation areas. After replacing a soak pit with a septic tank, concentrations of FC and chemical oxygen demand (COD) in the leachate at a depth of 2.1 m reduced from 2,500 to 1,000 CFU/100 mL and from 200 to 50 mg/L, respectively, after 150 days of the construction of septic tanks. To improve the hygiene and sanitation, the provision of toilets along with on-site waste management systems, capable of achieving required effluent quality, are essential.