Pools are places where large numbers of kids and adults congregate, so if there is a virus going around --and there are plenty -- it's a great place for a kid to pick it up.
Some folks have said sun poisoning, but if the problem were that, it would show up much sooner than 4-5 days after being exposed to the sun.
But the fact this always seems to be tied to the pool indicates the problem may be the pool itself. Either it's not well maintained (and the thought is just too gross!) or there are a LOT of smaller kids there who may be doing things in the pool that foul it. Does the pool shut down for 10 minutes each hour for enforced potty breaks? Our local rec center pools do that religiously, forcing ALL swimmers out of the water for 10 minutes of each hour, the idea being that it reminds parents to remove kids and make them use the toilets, or to change swim diapers, etc. If your gym pool does not do this, they should. But that wouldn't solve problems if the pool is improperly chlorinated and maintained.
I know you don't want to deny her the fun -- but is it really worth her getting sick every single summer? Your other daughter may be less affected because she just has more immunity to whatever is causing this, but why let one daughter suffer just so both can have a pool? Find another pool or do without.
If you continue at this pool and it happens again, get her doctor to run tests on her for things like E. coli, cryptosporidium, salmonella, shigella, etc. That may show that the pool's contaminated, and you would have grounds to go to the gym management and demand changes. But I wouldn't wait to make my kid an experiment like that; I'd stop going now.