All perfect praise be to Allah, The Lord of The Worlds. May His peace and blessings be upon our Prophet Muhammad and upon all of his family and companions.
From an Islamic perspective, valid marriage is that which meets all its elements and conditions. The marriage (which meets the required elements and conditions) of the person sentenced to death is valid and considerable in Sharia since the scholars have permitted the marriage of the sick person who is dying. This ruling applies to every scary thing that leads to death, such as burning or being sentenced to death. This view is based on the general meaning of the verse {Which means}: "Marry women of your choice." {An-Nisa`, 3}. It indicates the validity of the marriage of the person who is about to die. It was reported from a number of the companions that it is recommendable to get married before one`s death. Ibn Mas`oud said: "If I only have ten days to live and I am sexually potent, I would get married to avoid temptation." {Sunnan Sa`eid Mansour, vol.1, pp.164}. Al-Shafei said: "Mo`ad said: "Help me get married so that I don`t meet my creator while single." {Al-Umm, vol.4, pp.109}.
In conclusion, the marriage of the person sentenced to death is valid from an Islamic perspective and entails the rulings and consequences of valid marriage so long as it is concluded with the agreement of both parties. And Allah the Almighty Knows Best.