Allure Magazine recommends the first step is to get a shower filter. "Hard water with high levels of copper, and chlorine to kill the copper, is a threat to blondes. And even if your water isn't especially hard, copper piping could contribute to mineral deposits, so step one to preventing green hair is installing a shower filter."
Allure also recommends to wet your hair before getting in the pool."If you jump into the pool with dry hair, it's going to suck up the chlorine-and-copper water as fast as possible. Wet it before you go in to prevent that."
Thirdly, "unhealthy hair—either from hot tools, exposure to the sun, or coloring—will have the highest degree of green coloration because the protective cuticle is damaged and more copper can get absorbed into the hair shaft. Staying on top of hydration (think weekly deep conditioning) definitely helps."
Lastly, if your hair did turn green, you should visit a salon ASAP. Allure explains, "The good news is your hair didn't actually change color. That green you're seeing is actually just an oxidized mineral buildup. Copper, magnesium, and chlorine bind to the proteins on the surface of the hair shaft. But don't reach for a purifying shampoo—not only will it not remove the grassy tinge, it might actually strip hair dye. Instead."