According to the Torah, virginity is great virtue. Only Rebeccah in the entire Torah was called a virgin, which means that there were problems with women even in times of the patriarchs.
Here are a few interesting verses.
YLT Lv 21:1 And Jehovah saith unto Moses, 'Speak unto the priests, sons of Aaron, and thou hast said unto them, For any person a priest is not defiled among his people,
YLT Lv 21:2 except for his relation who is near unto him--for his mother, and for his father, and for his son, and for his daughter, and for his brother.
YLT Lv 21:3 and for his sister, the virgin, who is near unto him, who hath not been to a man; for her he is defiled.
YLT Lv 21:7 'A woman, a harlot, or polluted, they do not take, and a woman cast out from her husband they do not take, for he is holy to his God;
YLT Lv 21:8 and thou hast sanctified him, for the bread of thy God he is bringing near; he is holy to thee; for holy am I, Jehovah, sanctifying you.
YLT Lv 21:9 'And a daughter of any priest when she polluteth herself by going a-whoring--her father she is polluting; with fire she is burnt.
As you can see, Sons of Aaaron, Sons of the Priests and the Priests could not approach a dead person, unless it was the closest of kin. Most interesting verse is Lev 21:3, where it says that a priest may defile himself for his dead VIRGIN sister. So as you can see, even in death, virginity is considered holy and a virtue.
What does it mean? It means that virginity is a holy and a sign of a discerning (read - wise) woman that is fit to be a wife of a Priest. Why God gave Priests virgins to wives? Well...that's is because a priest was holy onto God and could not profane his status by associating with polluted women.
Does this mean that non-virgins are somehow worse than virgins? No, of'course not. However, those women who want to be holy to God and who want to show that they are wise, would keep their virginity for their one and only husbands.
Remember, what goes into the woman - stays there forever. So of'course a Priest could not mix his holy seed with a seed of non-priest. This is why even honest divorced women would not be fit for the Priest.
This is this concept in a nutshell. There are many more nuances to this which I will explain in my other posts on this subject.