Science has been puzzled throughout history by the physiological (or evolutionary) function of the hymen. Only a few weak scientific hypotheses exist, but the current consensus is protection of the foetus from infection by external sources.
From an evolutionary point of view one could turn the question around:
Why wasn’t the hymen removed by evolution?
Evolution is not based on the usefulness of a trait, but on natural selection. This means a certain trait will persist trough generations, unless it hinders reproduction. Like the appendix, wisdom tooth and goose bumps (we lost our fur which provided insulation and intimidation if puffed up), the hymen doesn’t hinder reproduction. So although it doesn’t serve a purpose there’s no reason to select against women with a hymen.
Another reason why it would be difficult for the hymen to die out (at least in the short term) is the fact that (mostly) all reproductively capable women are born with one.