If the purpose of the question is general knowledge, the different views based on the jurisprudence of the absent (Arabic: الغائب) or missing (Arabic: المفقود) husband are presented below. If the purpose of the question is to get a ruling on a specific case, the concerned parties must consult a scholar or a mufti who has the appropriate level of knowledge to address the context, and not from anonymous people on the Internet.
There is a difference of opinions based on the schools of jurisprudence.
In Al-Hujja (Arabic: الحجة على أهل المدينة), Vol. 4, pp.49-52, the author Muhammad al-Shaybani said that Imam Abu Hanifa said in regards to a missing husband, it is not permissible for his wife to marry until confirmation of his divorce or his death. She first observes the period of waiting (iddah, Arabic: العده), then she can get married afterward. If she gets married, then her missing husband appears, she gets divorced from her other husband. If the marriage from the other husband has been consummated, she keeps her dowry (al-sadāq, Arabic: الصداق).
In Muwatta Malik (Arabic: موطأ مالك), Imam Malik ibn Anas quoted 'Umar ibn al-Khattab that if a woman's husband is missing for four or more years, she may be declared divorced. After her iddah, she can get married again. If her missing husband returns after the marriage contract is done, whether the marriage is consummated or not, she remains with the second husband. If the missing husband returns prior to the second marriage contract is done, her first (missing, now returned) husband has the right to keep his marriage to her.
In Mughni al-Muhtāj (Arabic: مغني المحتاج إلى معرفة معاني ألفاظ المنهاج), Vol. 4, pp. 522, Al-Khatīb Ash-Shirbīniy said that the missing husband, if he appears after his wife got married to a second husband, then the first husband keeps his wife, but he cannot resume marital relationship until after her iddah is over.
In Kashāf al-Qinā' (Arabic: كشاف القناع عن متن الإقناع), , Al-Bahūti said that if the missing husband returns after the second husband has consummated the marriage, the returning (first) husband is given the choice to keep his wife (a divorce from the second husband is not required, but iddah is required), or to opt out of the marriage (then she keeps her second husband without the need for another marriage contract).