Can I still pray for him from a distance?
Absolutely. You should. We don't have to be with someone to love them.
In my case, I have no love for my ex AGF. But I still pray to God that she's safe and that He protects her. And I do that every night before I go to sleep. When we show compassion towards others, that has the additional benefit of healing us. That doesn't mean we have to agree or approve of what they did. All it means is your ex, just like mine, is a fellow traveller that is, unfortunately, very sick.
And you know what?
It does make a difference.