Answering a really old question... In the current season of Ask This Old House (aired during the 2012 Cambridge House TOH season), they used a heat exchanger to take waste heat from a heat pump (that the homeowner is already using to heat/cool his home) and use that to heat the pool. Something like on this site:
The output of the pool pump is plumbed to go through the heat exchanger.
The lineset serving the heat pump is spliced into the heat exchanger.
There is a switch/controller that is part of the heat exchanger. When the heat pump runs, the controller detects if the pool needs to be heated (based on set temperature). If so, the refrigerant is routed through the heat exchanger, heating the water and getting dispersing the heat from inside the building. If the pool does not need to be heated, the refrigerant goes through heat pump as usual.
The heat exchanger was represented as using wasted heat (from inside the house) to heat the water, so the pool was heated for "free" without affecting the cooling of the house. Don't know if that is completely true or not, but that is what was said.
There is probably more to it, but that is what I remember from the Ask TOH show.
Note that in this segment of the show the homeowner already has a conventional heat pump that is used to heat/cool his home. The plumber/HVAC guy installed a heat exchanger that allows the transfer of the waste heat the heat pump generates during the cooling season into the pool water. This answer is not about having a dedicated heater for the pool. It is also not about heating the pool during the non-cooling season as the heat pump only generates waste heat when it is in cooling mode.