Upvote:1
In the Gospel of Matthew, this account is given to us:
Now the birth of Jesus Christ was as follows: when His mother Mary had been betrothed to Joseph, before they came together she was found to be with child by the Holy Spirit. 19 And Joseph her husband, being a righteous man and not wanting to disgrace her, planned to send her away secretly. 20 But when he had considered this, behold, an angel of the Lord appeared to him in a dream, saying, “Joseph, son of David, do not be afraid to take Mary as your wife; for the Child who has been conceived in her is of the Holy Spirit. 21 She will bear a Son; and you shall call His name Jesus, for He will save His people from their sins.”
22 Now all this took place to fulfill what was spoken by the Lord through the prophet: 23 “Behold, the virgin shall be with child and shall bear a Son, and they shall call His name Immanuel,” which translated means, “God with us.” 24 And Joseph awoke from his sleep and did as the angel of the Lord commanded him, and took Mary as his wife, 25 but kept her a virgin until she gave birth to a Son; and he called His name Jesus. Matthew 1:18-25 NASB
It is important to note here that Joseph kept her a virgin until she gave birth. Thus, it was not merely that Mary conceived when she was a virgin, nor did she conceive at the time that she lost her virginity, but that Jesus was a born of a virgin--that is, that Mary was a virgin up to the time she gave birth go Jesus.
Also, this was what was prophesied in Isaiah 7:14--700 years prior.
Luke gives us a bit more information as well when recording the angel's conversation with Mary:
The angel said to her, “Do not be afraid, Mary; for you have found favor with God. 31 And behold, you will conceive in your womb and bear a son, and you shall name Him Jesus. 32 He will be great and will be called the Son of the Most High; and the Lord God will give Him the throne of His father David; 33 and He will reign over the house of Jacob forever, and His kingdom will have no end.” 34 Mary said to the angel, “How can this be, since I am a virgin?” 35 The angel answered and said to her, “The Holy Spirit will come upon you, and the power of the Most High will overshadow you; and for that reason the holy Child shall be called the Son of God. Luke 1:30-35 NASB
Here, Mary asks how it can happen, since she is a virgin. The angel's response is that it will occur by the power of the Holy Spirit, and that for this reason, Jesus would not be the son of Joseph, but would be called the Son of God.
Theologically speaking, this was necessary for a number of different reasons. Jesus was a descendant of David through Mary biologically, but received the right to the throne through His adopted father Joseph. Again, there are more reasons for this necessity as well, but to go into them all would be quite lengthy.