LUKE 1:26-38
Compare Mary's visit by the angel to Zacharias' just six months before.
Gabriel told Zacharias he would have a son by a miraculous birth and he asked how a thing like that could be, since both he and his wife were beyond childbearing age. Zacharias' unbelief angered Gabriel and he struck him dumb until the boy was born, Luke 1:18-20.
Mary asked a similar question, but Gabriel's response was much kinder. Since God is no respecter of persons, Romans 2:11, we assume the heart motivations behind their questions were different.
Zacharias asked in unbelief, a statement of scorn rather than an inquiry. Mary asked to gain information not because she didn't believe what she was being told.
When God tells us something in His Word, by His Spirit or even by a messenger, there is nothing wrong with asking questions if it is with a right heart attitude. If she hadn't asked, she may have assumed He would come through the natural way between Joseph and herself.
We need wisdom that only God can give us, but it must be asked with a right heart.