Per IRS Publication 17 Your Federal Income Tax (For Individuals), page 23:
Nonresident alien spouse. You are considered unmarried for head of household purposes if your spouse was a nonresident alien at any time during the year and you don’t choose to treat your nonresident spouse as a resident alien. However, your spouse isn't a qualifying person for head of household purposes. You must have another qualifying person and meet the other tests to be eligible to file as head of household.
Choice to treat spouse as resident. You are considered married if you choose to treat your spouse as a resident alien. See chapter 1 of Pub. 519.
IRS Publication 54 Tax Guide for U.S. Citizens and Resident Aliens Abroad, page 7 outlines how to obtain a Social Security Number (SSN) or an Individual Taxpayer Identification Number (ITIN) for the nonresident alien spouse chosen to be treated as a U.S. resident.
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the webpage or document at the time it is accessed.