They must be in the "PotentialMarriageFaction" (this much is obvious -- an NPC can be added using "AddToFaction 19809" in the console).
The NPC in question must have a relationship rank of one or above (in other words, they are considered to be your friend. Use "SetRelationshipRank Player 1" in the console if the NPC doesn't like you enough).
Finally, the NPC must be one of the following voice types (each of these has an example NPC, so you can gauge roughly what your potential spouse will sound like. I've tried to pick characters that players are likely to have encountered; a good deal are race-specific, although some members of that race do not use them. To make it even easier, I've included the lines the NPC will say if they're in a friend state with you):
-MaleEvenTonedAccented (Farengar Secret-Fire, Hemming Black-Briar)* - "Divines smile on you, friend."
-MaleCommonerAccented (any carriage driver) - "Good to see you again, friend."
-FemaleCommander (Aela the Huntress, Legate Rikke)* - "You're someone who can get things done. I like that."
-MaleBrute (Orgnar, Farkas)* - "You've been a good friend to me. That means something."
-MaleCoward (Arniel Gane, Proventus Avernicci) - "Divines bless you. May the ground you walk quake as you pass."
-FemaleCoward (Silda the Unseen, Edda) - "It's so good to see you again."
-FemaleShrill (Viola Giordano, Colette Marence) - "Good to see you. At least you know how to treat someone properly."
-FemaleOrc (practically any female Orc)* - "May your weapons be sharp and your prey fresh."
-MaleOrc (practically any male Orc)* - "May your next fight bring you victory, friend."
-MaleDrunk (Sam Guevenne, Embry)* - "My favorite drinking buddy. Let's get some mead."
-FemaleDarkElf (many Dunmer women)* - "We're one of the same kind, you and I. I'm glad to have met you."
-MaleDarkElf (many Dunmer men)* - "Azura's wisdom to you, friend."
-MaleCommoner (Louis Letrush, Omluag) - "Good to see you again, friend."
-FemaleCommoner (Drifa, Greta) - "Now here's a man/woman I'm glad to see."
-FemaleArgonian (all female Argonians) - "It is our most favored company."
-FemaleElfHaughty (Gabriella, Taarie) - "So nice to have pleasant company for a change."
-FemaleEvenToned (Carlotta Valentia, Anneke Crag-Jumper)* - "What do you need, my friend?"
-FemaleNord (Mjoll the Lioness, Hulda) - "A fine day to you, friend. May you die with a sword in your hands."
-FemaleSultry (Sybille Stentor, Saadia)* - "It's so good to see you again."
-FemaleYoungEager (Ysolda, Elisif the Fair) - "It's a fine day with you around."
-MaleArgonian (any male Argonian)* - "Ours is to smile at your passing, friend."
-MaleCondescending (Nazeem, Savos Aren) - "Good to see you. Finally someone useful is around."
-MaleEvenToned (Marcurio, Maramal)* - "Divines smile on you, friend."
-MaleNord (Balgruuf the Greater, Ralof)* - "May the gods watch over your battles, friend."
-MaleSlyCynical (Belethor, Erikur) - "You and me, we're the only people around who aren't complete fools."
-MaleYoungEager (Onmund, Sven)* - "Good day, friend! Keeping well?"
-FemaleCondescending (Gisli, Grelka)* - "Friends like you are hard to find and very valuable to me."
*Can serve as a follower, if in the "PotentialFollowerFaction" (5C84D).
Follower voices also include MaleKhajiit (all Khajiit males).
There are three voice types -- MaleSlyCynical, FemaleNord, and MaleUniqueCicero -- that are used by followers, but their lines are filtered to their specifc actor.
The conditions aren't race-specific -- for example, many Bosmer use the above voice sets even though none are able to be married by default. In addition, if you were to create a Khajiit NPC and assign them a voice that's not "MaleKhajiit" or "FemaleKhajiit", they could be married. There is, however, no means of changing an NPC's voice in-game.
