Borrowed from http://www.living-family-history.com/valentine.html:
Long before anybody had heard of Saint Valentine to warm the heart and inject passion into the equation, mid-February was looked forward to as an exciting time for lovers. From 400 years BC, Roman citizens held a popular yearly sweepstake as an act of worship to their god Lupercus. Young women's names were put into a box and then picked at random by eager young men. The couples thus selected were then legally paired for the next twelve months.
Six centuries later, the soldier-emperor Claudius II banned young males from getting married -- because he took it into his head that unattached youths made better soldiers.
An early Christian priest, Valentine, didn't agree with his Emperor and continued to marry young couples in secret until Claudius dicovered his disloyalty and after imprisoning him, eventually had him brutally executed on February 24th, 270.
The story goes that while he was locked up, Valentine fell madly in love with the daughter of his jailer and when he was finally taken to be killed, he wrote her a message signed, 'From your Valentine.'
Using the name of the martyred priest as an excuse, the Church, in AD 496, took the opportunity to finally abolish the pagan ancient lottery held to worship the god Lupercus and so decreed a small change in the rules:
From then on, either gender would pick a name out of the hat, but instead of getting a year of companionship (and most likely the sexual gratification that came with it), they drew the name of a Saint whose life they were expected to emulate for the next year.
What a crushing disappointment that must have been for the lusty youngsters
in Roman days!
The day of the new-style lottery was named in honor of Saint Valentine whose choice, 226 years after his death, was intended more to displace the traditional god Lupercus than from any honest reverence towards love.
As so often happens, public memory was more powerful than the latest political ideas -- especially when as unpopular as this, and Saint Valentine remained associated with passion and love. Young Roman men, missing their traditional sweepstake, took instead to handing hand-written notes to the girls they admired on February 14th.
Happy Valentine's Day!