Given how quickly this came on, I don't think that it is likely to be a cancer or other serious medical problem. Hoarseness
and changes in the voice can be signs of laryngeal (throat) cancer, but usually this develops slowly over weeks to months. Waking up suddenly without being able to talk, on the other hand, is more consistent with acute laryngitis.
Acute laryngitis is an inflammation of the voice box (larynx) that is almost always caused by a common viral infection, often the same types of viruses that cause the cold or the flu. Bacteria can also cause acute laryngitis, although this is less common. Finally, there can be mechanical inflammation of the larynx which causes laryngitis in the absence of infection - this, for example, explains why singers are sometimes hoarse after a concert.
Fortunately, acute laryngitis is a self limited condition that will get better on its own. If you have any pain or discomfort, you can take an over the counter anti inflammatory medication to improve those symptoms. Otherwise, there is not much to do except wait a few days for the symptoms to subside!
Talk to your primary care doctor
for more information about how this issue affects you.