God spoke to Rebekah once, perhaps twice
When Rebekah was in misery during her pregnancy, God told her that she was going to bear twins and that the older would serve the younger. Down through the centuries, speculation has arisen about this encounter. Did God visit Rebekah in physical form as He did to Abraham? Did He speak only to her heart or did she have an angelic visitation? Where did God speak to her? Was she in her tent, or taking a walk through the camp? Was she kneeling at an altar Isaac had built, (though that might have been hard when she was so large with the twins inside her). Was it daytime or darkest night? All we know from Genesis 25:21-23 is that Rebekah went to inquire of the Lord and He answered her. So we do know that God spoke to her at least once.
But earlier in Genesis 24:1-9, before Rebekah met Isaac, Abraham told Eliezer, his servant, that God would send His messenger ahead of him to find a wife for Isaac. In other parts of Scripture, we are told that angels are God's messengers. Could that heavenly messenger have met Rebekah at that time, to prepare her, to guide her to be willing to follow Abraham's servant to a land and people she did not know?
Perhaps Rebekah inquired of the Lord about the twins because she had already heard from Him the last time she'd faced something momentous. Could she have known that only He would be able to give her the answers, the help, the guidance, and the comfort she needed?
We aren't told the details, but it is not a far stretch to imagine how it might have been.