According to South Carolina law:
SECTION 20-1-10. Persons who may contract matrimony.
(A) All persons, except mentally incompetent persons and persons whose marriage is prohibited by this section, may lawfully contract matrimony.
(The prohibited list includes close relatives, people who are already married, people under 16, and people of the same sex, although the last one has obviously been overturned by court decisions.)
So, it would depend on whether the person was still mentally competent. According to Thompson v. Moore, 227 S.C. 417 (1955):
The term "mentally incompetent" is difficult of exact definition. Mental incompetency "in its ordinary meaning imports mental deficiency so great as to render one unable to comprehend or transact the ordinary affairs of life."
South Carolina law also has this provision:
SECTION 20-1-530. Declaration of invalidity.
If any such contract has not been consummated by the cohabitation of the parties thereto the court may declare such contract void for want of consent of either of the contracting parties or for any other cause going to show that, at the time the supposed contract was made, it was not a contract.
This could come into play since they aren't really cohabitating while one party is in the hospital.