Yes, and it's very common. Pool heating solutions include heat pumps, solar panels or electric heating.
A pool enclosure can also extend the swimming season while reducing energy consumption.