Did any loyal companions of Imam Ali (as), such as Huzaifa bin Yaman, participate in the battles during the era of the first and second caliphate? If so, how can that be explained?
Huthaifa Ibn al-Yamaan was one of the very pious companions of the Proaphet Muhammad (SAWA) and Ameerul Mo'mineen (AS). He is one of the four best companions of the Prophet (SAWA).
He was informed by the Prophet about the names of the Munafiqeen (hypocrites). Omar Ibn al-Khattab used to repeatedly ask him: Did the Prophet mention my name with the Munafiqeen?
He used to boycott praying on dead body of any Munafiq. He did not pray on many well known persons in Madina.
The narration that Huthaifa took part in al-Yarmouk battle is not in our books but in a Sunni book called al-Waafi bil Wafayaat by al-Safadi (V.11, P. 251).We can not trust such narration.
Huthaifa fought against Mo'awiyah in the army of Ameerul Mo'mineen (AS) in Siffeen battle.
Huthaifa was requested by Omar and Uthman to look after al-Madaa'in. Omar and Uthman wanted to show respect to him being the person who has secrets from the Prophet. He accepted to help Muslims and protect them from corrupt rulers. Imam Ali (AS) also appointed him as a ruler on al-Madaa'in.
Wassalam.