The reason you are told to not sleep on your back after the first trimester is that it may partially hinder the blood flow to your baby due to the weight of your pregnant uterus compressing your major blood vessels. Instead, sleeping on your left side is recommended.
This recommendation is somewhat exaggerated and is causing a lot of women to have terrible sleepless nights with resulting left sided arm, hip, and leg pain, which contribute even more to their fatigue. Many women will also wake up one their back or stomach and worry about that they have harmed their baby.
Your enlarging uterus lies over the largest vein in your body called the ‘vena cava’. This vena cava lies mostly on the right backside of your abdomen as it travels upwards and brings blood from the lower part of your body to your heart and lungs. Theoretically, the large uterus could compress and block off the blood supply unless you are lying on your left side, but it turns out that every woman’s anatomy is different. There are certainly some women where this is seen, but in most women, plenty of blood will flow despite lying on their backs. Any blood flow restriction will usually be felt by your heart and lungs and will cause the sensation of not being able to breathe, resulting in your waking up.
This applies to being on your stomach as well. As long as you are comfortable, your baby is probably getting enough blood flow as well. Most medical providers have never had a patient who has harmed their baby by sleeping on their back or stomach.
Having said all of this, it is a good idea to play it safe. Try to use a small thin pillow to provide a tilt to either side of your back. Both left and right sides are fine, and don’t worry if you move ending up having slept on your back for most of the night. If there is an issue with the blood flow, your body will have most likely awakened you.