The easy answer is YES! You can put solar pool heating panels and solar electric panels on the same roof. The real question is do you have enough space, and what is the best orientation?
Our general recommendation is to save your best roof for solar electric panels. Because they are more expensive and reliant on a good orientation for performance, selecting a nice south roof is ideal. Solar pool heating panels can then be added to other roofs (SW, SE, W, or E) based on space available. Increasing the size of the solar pool heating system to account for the sub-optimal orientation can help.
In this system design below, we opted to maximize the south roof with solar electricity. Then we used the large east roof to place an over-sized solar pool heating system, and then used the remaining east roof space for more solar electric panels. We could have selected the south roof for a smaller solar pool heating system, with equal performance due to the orientation, but the goal here was to provide the best return on investment for the solar electric panels, and then still find space for a solar pool heater.