This could be a number of possibilities, but whenever breathing is involved, it is considered serious. I will let you know some of the things that it could be, but it is important that you follow up with your doctor for evaluation and treatment.
Whenever breathing difficulty occurs from laying down flat, this is considered abnormal. Specifically when you wake up at night with shortness of breath, this is called paroxysmal nocturnal dyspnea.
One of the most common and least worrisome of the possibilities is snoring. You may have been having difficulty getting enough oxygen in your lungs and when you wake up and finally realize it, you've been struggling for a little while and this has caused you the discomfort. Sleeping on the left side, using a humidifier while you sleep and trying sleep aids (like the breath right strips availiable over the counter) can help if this is the problem. This also may include the possibility of sleep apnea (a more severe form of snoring in which your airways become blocked from laying flat... sometimes requires a breathing mask while sleeping called a CPAP)
You may also need to be evaluated for the possibility of asthema (if you have a reactive airway, it may not be sleeping that is causing this but actually dust in your room or an allergy to a pet).
You will also want to be evaluated for COPD or chronic obstructive pulmonary disorder (especially if you smoke), cor pulmonale and heart disease (especially if you have any medical history related to heart problems).
I hope this information helps, if it did, please press ACCEPT, Thanks!