Yes! It is great to combine a heat pump (which uses electricity as an input) with a PV system.
The trick is to have the right amount of solar power output relative to your heat pump input, and also being able to use the PV energy at the right times (there’s no point in having a PV solar system combined with your heat pump if the solar system produces energy during the day, and the heating system is only used at night).