To avoid getting this again, get out of bed and from a sitting position slowly.
Keep a note of any symptoms that you have as this may be related to this episode. If you have a sore throat, headache, earache.
Although the blood pressure can change with movement and make you feel dizzy and flake out - this is referred to as postural hypertension or Orthostatic hypertension, some illnesses and infections can also make you feel dizzy.
As this has happened to you, be aware that it can happen again, and to help to avoid this, get up slowly and stand still for a few minutes until things settle. If you have cervical problems (neck bones), what you experienced can sometimes be from that.
Make an appointment to see the doctor so that he can run some checks.
You likely had an Orthostatic Hypotension Vasovagal episode.
Underlying factors should be investigated thoroughly.
B12 deficiency, hypovolemia, anemia etc.
To test Orthostatic Hypotension is very easy.
A drop of 20 points in the systolic and/or 10 point drop in diastolic pressure
between lying down and standing up readings after lying flat for 5 minutes, standing up after 1 min. and again after 3 min. All you need is a BP monitor.
Cardiac output compensation by the heart is indicated by a rapid increase
in heart rate from lying down to standing (or even sitting up as in your case), so measuring heart rate in both positions would confirm this.
Let us know how you're doing later, but consider to have a medical evaluation for this, asap.
Please note that my suggestions and comments were based only on the details from your post, however, they are not intended to replace medical advice.
Best wishes.
Niko