During pregnancy you will often hear that sleeping on your back is a bad idea. The reason has to do with your anatomy. When you lay on your back after about the fourth month of pregnancy, the weight from your pregnant uterus can decrease the blood flow in the vena cava, the vein that brings blood form the lower part of your body to the heart. If this were to happen, there is a risk of decreasing the blood flow to your uterus and baby.
The vena cava runs slightly to the right of your spine. This is why you may hear that laying on your left side is the best option. The key is really not laying on your back, either side is usually fine.
So what happens when you wake up in the middle of the night and you're laying on your back? Don't worry. Just roll over onto a side or prop your body with a pillow to turn you one direction or the other.
Using pillows between your legs while you sleep can be more comfortable. It can also help you remember not to roll over on your back, even when you are asleep. Any pillow will work, but there are special pillows made for pregnant women.