This was probably a very ancient Indo-European religious custom, because ancient Ireland had an order of chaste priestesses devoted to Brigid (a hearth goddess like Vesta) and they also tended an “eternal flame” just like the Vestal virgins. The existence of two such highly similar religious orders among European cultures separated by great distances and differences in language and social structure implies that the tradition goes back to a much earlier time in Indo-European history.
So, what's the reason for it? There's more than one way to look at it. It could have something to do with attempts to control female sexuality, so that women could only hold such a powerful position if they were not sexually active. It could just as easily have to do with the idea that abstaining from sex builds up numinous or magical power, making the person “more holy”- not in a moral sense but just as a conduit for spiritual energy.