God communicated through dreams and visions.
Throughout the Bible, GOD spoke or communicated with individuals in multiple ways. Sometimes He spoke directly with them, as He did with Adam, Eve, Cain, Abraham, Isaac, and Jacob.
Other times, GOD revealed messages through visions and dreams. GOD told Moses' siblings:
6 Then He said, “Hear now My words: Should a prophet of yours belong to the Lord, I would make Myself known to him in a vision; I would speak to him in a dream. 7 Not so with My servant Moses; He is faithful in all My house. 8 I speak with him face to face, even in visible form, and not in obscure sayings; and he saw the Lord's glory.
(Numbers 12:6-8a OSB)
Sometimes GOD sent warnings by dream. For example, GOD warned Abimelech not to touch Sarah (see Genesis 20:1-7). And GOD warned Laban not to speak evil towards Jacob who had secretly left to return home (see Genesis 31:24).
In other cases, GOD revealed promises and blessings, and even future events, through dreams.
One such instance is found in Genesis 37. In that text, Joseph had 2 dreams:
5 Then Joseph had a dream, and reported it to his brothers. 6 Thus he said to them, “Hear this dream I dreamed: 7 There we were, binding sheaves in the field. Then behold, my sheaf arose and also stood upright; and indeed your sheaves stood all around and bowed down to my sheaf.” 8 So his brothers said to him, “Shall you indeed reign over us? Or shall you indeed have dominion over us?” So they hated him even more for his dreams and for his words.
9 Then he dreamed still another dream and told it to his brothers, and said, “Look, I have dreamed another dream. And this time, the sun, the moon, and the eleven stars bowed down to me.” 10 So he told it to his father and his brothers; and his father rebuked him and said to him, “What is this dream you have dreamed? Shall your mother and I and your brothers indeed come and bow down on the ground before you?” 11 And his brothers envied him, but his father kept the matter in mind.
(Genesis 37:5-11 OSB)
As in this case, GOD's revelations in dreams were often mysteries that needed to be explained or understood in the future. In this case, perhaps GOD was providing a message that would comfort Joseph and his family in the future, once Joseph rose to power in Egypt. Or, perhaps GOD used these dreams knowing that Joseph would share them with his brothers, which would inspire them to put Joseph in the pit that led to Joseph going to Egypt.
One thing is certain: GOD is always working intimately on, in, and through each person involved in any given situation.
Some of these dreams and visions have a direct impact upon you and me and our future. Exciting!