The Roman fertility feast of Lupercalia was celebrated in mid-February by men first sacrificing a goat and a dog. They then whipped women with the hides of the slain animals.
"Young women would actually line up for the men to hit them. They believed this would make them fertile," says Noel Lenski, a historian at the University of Colorado.
The celebration included a matchmaking lottery, in which young men drew the names of women from a jar.
According to Brian Bates, a professor at the University of Sussex, "Young men and women drew lots for sexual partners in preparation for a day of sanctioned license the following day."
How did we get from the Roman version of hooking up to chocolates and roses? We can thank Emperor Claudius II.
Roman Emperor Claudius II executed two men - both named Valentine - on Feb. 14 of different years in the 3rd century A.D. One of these Valentines was a priest who secretly married couples against the wishes of Claudius, who believed that unmarried men made better soldiers. Apparently "Valentine" was a common name in those days because there are reports that a 3rd "Valentine" was also beheaded by Claudius II.
Their martyrdom was honored by the Catholic Church with the celebration of Saint Valentine's Day.
In an effort to control the lewder aspects of the Lupercalia festival, the church fathers made a few changes to the pagan holiday. Instead of drawing the names of sexual partners out of a box, young men were encouraged to pick the names of saints—and then spend the following year emulating the saint whose name they drew.
The church tried to change the focus of the holiday from sexual license to chaste romantic love.
Not surprisingly, the romantic aspect is what became and remains popular, not the more austere love of the Christian martyrs.
Read more about the connection between Lupercalia and Christian Martyrs from these sources: here and here.