Dreams are the subconscious playing out mental, emotional and even spiritual elements to find an inner harmony. It is like the brain is a hard drive and is organizing the data and formatting it better during off hours.
That being said, dreams can reflect circumstances that have happened, are happening, and sometimes even circumstances that will come. Many people feel their dreams have been like premonitions, but you have to be careful not to become superstitious about them. Just because you dreamt it doesn't mean it will happen, unless God told you — which can happen in some circumstances.
The Bible definitely shows us that God does speak through dreams and to important figures like Joseph, Jesus' foster father (Matthew 2), and Daniel from the Old Testament (Daniel 7:1-8) among others: (Genesis 20:1-7, Genesis 28:10-12, Genesis 31:1-24, Genesis 37:1-20, Genesis 40:1-17, Genesis 41:1-32).
God may choose to speak in this context because it is less intimidating than an actual awake encounter, but keep in mind that demons can influence dreams as well, so good discernment is still necessary.