How did Joseph find out that the Holy Ghost got Mary pregnant?
An angel told him in a dream
Then Joseph her husband, being a just man, and not willing to make her a publick example, was minded to put her away privily.
But while he thought on these things, behold, the angel of the LORD appeared unto him in a dream, saying, Joseph, thou son of David,
fear not to take unto thee Mary thy wife: for that which is conceived in her is of the Holy Ghost.
Matthew 1:18Now the birth of Jesus Christ was on this wise: When as his mother Mary was espoused to Joseph, before they came together,
she was found with child of the Holy Ghost.
Then Joseph her husband, being a just man, and not willing to make her a publick example, was minded to put her away privily.
But while he thought on these things, behold, the angel of the LORD appeared unto him in a dream, saying, Joseph, thou son of David,
fear not to take unto thee Mary thy wife: for that which is conceived in her is of the Holy Ghost.
Matthew 1:18