A kohen cannot marry a divorcee, "zonah", or "chalalah". A kohen gadol, additionally, cannot marry a widow. Why do these laws exist?
My theory is that:
1) Speculatively: If a kohen married a promiscuous woman, it would shame him and by extension his priestly office. People would assume that her immorality reflected his immorality, or that he was likely suffering the humiliation of being cheated on by her. To avoid this shame to him and his office, he is prohibited to marry a "zonah", who was promiscuous. Perhaps the law of "chalalah" fits here too.
2) Speculatively: In ancient times divorce was usually due to suspicion of infidelity on the part of the wife. Therefore, a kohen marrying a divorcee would present the same issue as marrying a known promiscuous woman (perhaps to a lesser extent), so the Torah prohibits it.
The Mishna (Gittin 9:10) lists three opinions about when a husband may divorce his wife:
* Beit Shammai: only if he found a "matter of immorality" in her
* Beit Hillel: Even if she burned his food
* R' Akiva: Even if he found a more beautiful woman
Modern halacha follows R' Akiva, but all three opinions have their basis in Biblical verses (mentioned in the Mishna), and it may be assumed that all three are reasonable interpretations of the attitude to divorce expressed in the Bible. If we are to take the "consensus" of these opinions, it seems likely that many divorces in Biblical times were motivated by the wife's suspected adultery, even if there was no requirement that ALL divorces have this basis.
Should this approach stigmatize divorcees today as likely adulterers? No. Many divorces nowadays have no connection to adultery, and even if a kohen married a known adulterer, I don't think her stigma would transfer as easily to him now as it did in the past. So nowadays, this is a law without a purpose. This is not disturbing: There are many mitzvot whose purpose was relevant in the ancient world and not today (for example: not making sculptures of the moon, lest you worship it), and I am comfortable adding one more to the list.
This approach suggests that if a woman was divorced and then widowed, she would still be forbidden to a kohen, as the stigma from her original divorce would remain in her history. (This seems to be accepted halacha today.)
3) Speculatively: The kohen gadol must have even higher standards than a regular kohen. Thus he must marry a virgin, and cannot even marry a widow.
A virgin can be physically examined for signs of virginity. A widow has no signs of virginity, so there is no conclusive way of verifying that she has never been promiscuous. Apparently, for the kohen gadol, the requirements are similar to a regular kohen, but stricter.
This assumes that virginity is a physical state, which can be determined by physical examination. I hear that according to modern science (and to a lesser extent, sources in Chazal), this is not the case: a woman can have or lack the physical signs of "virginity" whether or not she is actually a virgin. But because our approach is based on how the kohen gadol in ancient times was viewed by people around him, what matter is not the science, but rather what ancient people *thought* was the science, even if they were wrong.