All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
If a woman travels with her husband for Hajj but he died before finishing the rituals and after Ihraam, then she should complete her rituals. The death of her husband does not affect her rituals. Concerning the man, it is not needed to complete the rituals on his behalf or offer a ransom.
Allaah Knows best.