Why do worms end up in my pool after rain?

I have been experiencing the same problem. when it rains, the worms come to the surface to prevent drowning in the flooded soil. They aren't terribly bright and often fall into the pool and drown. what I don't get is how they are ending up in my pool which is surrounded by a screen enclosure. I have read that adding limestone to the soil surrounding the pool will discourage the pests from entering the area.