The Legion was ultimately defeated by the Legends, so it’s possible that he’ll have had (yet another) change of heart and switched sides again.
Appearing only via hallucination and flashback in Season 5 so far, he’s spent the majority of his time as a member of the Legion of Doom over on Legends of Tomorrow.
Of course, viewers who have been watching all four of The CW’s DC series in the 2016-2017 TV season might be a little taken aback to see Malcolm Merlyn helping the heroes.
Whatever the reason, as long as Thea is on Oliver’s side in the finale arc of Arrow Season 5, we can bet that Malcolm will probably do what he can to keep her as safe as possible.