Short answer: The translation of Virgin in the gospels is correct, the meaning in the original gospel text is indeed that Mary did not have sex before getting pregnant. There is a story of the word "Virgin" being mistranslated in the Bible (so what you heard might have been correct) but it happened at a earlier stage.
Background: As you may know, there are some prophecies in the Hebrew bible (what Christians know as the Old Testament) which foretells the birth of a "messiah", a king which will resurrect the kingdom to its former glory. [Source] The early Christians believed that the person Jesus was actually this messiah, so the gospels make a lot of effort to "prove" this by showing how various events and and actions by Jesus corresponds to the prophecies. For example, a prophecy states that the messiah would be a descendent of King David. [Source] Therefore two of the gospels, Luke and Matthew, produce genealogies which show how Jesus descend from King David through the male line. However, the two genealogies are completely different! This means that at least one of them must be fake. So we know that the gospel writers (or the early christian oral tradition which the writes are based on) would go to great length to "prove" how Jesus fulfilled the prophecies, including (to put it bluntly) making up evidence. [See Matthew 1:1 and Luke 3:23 for the conflicting genealogies]
So, the prophet Isiah have a passage when he states that the Messiah will be born by a young girl [See Isaiah 7:14]. Isaiah is of course written in Hebrew, the original language of the Hebrews/Jews. But at some point many Jews had migrated to Greek-speaking regions [Eg. Alexandrine Jews], and lost the Hebrew language. So the Hebrew bible was translated to Greek. This famous translation is called Septuagint. Now in this Septuagint the Isaiah passage is translated such the the meaning becomes virgin (girl who have not had sex) rather than just young, unmarried girl. [Source]
You can see where this is heading: Now the Greek-speaking Jews believe that the Messiah have to be born by a virgin, and the writers of the gospels (which were also Greek-speaking and referred to the Septuagint when quoting the prophets [Source]) will have to include a story that shows that Jesus was actually born by a virgin in order prove that Jesus was the Messiah. [Source] Now I'm not claiming that the gospels authors made up the story of the virgin birth, since it is impossible to know (only the parents of Jesus would have known what actually happened in any case) but it is interesting to know that Jesus and his original followers did not even know that the Messiah was supposed to be born by a virgin, since they were Aramaic speaking and referring to the original Hebrew scriptures, not the mistaken Greek translation. [Source]
References
Matthew 20-22, New International Version:
20 But after he had considered this, an angel of the Lord appeared to
him in a dream and said, “Joseph son of David, do not be afraid to
take Mary home as your wife, because what is conceived in her is from
the Holy Spirit. 21 She will give birth to a son, and you are to give
him the name Jesus,[f] because he will save his people from their
sins.”
22 All this took place to fulfill what the Lord had said through the
prophet: 23 “The virgin will conceive and give birth to a son, and
they will call him Immanuel”[g] (which means “God with us”).
The section makes it clear that Matthew considers the virgin conception proof that Jesus fulfilled the prophecy in Isaiah. Now, Judaists may argue that Isiah is not really talking about the Messiah in this passage, which is a valid interpretation of Isiah, but not really relevant - the question is if Matthew considered it a valid prof, and it is quite clear that he does and expects his audience to.
Isaiah 7:14 - New Revised Standard version
https://www.biblegateway.com/passage/?search=Isaiah+7%3A14&version=NRSV
14 Therefore the Lord himself will give you a sign. Look, the young
woman[a] is with child and shall bear a son, and shall name him
Immanuel.[b] Footnotes:
Fotonote: Isaiah 7:14 Gk the virgin
The New Revised Standard version is considered the translation closest to the Hebrew scriptures and using the best available sources, including the Dead Sea Scrolls which where not available to previous translations from Hebrew.