When it comes to Roman rituals and Roman religion, there is great uncertainly. That is an honest answer. For example, if you read Cicero, Varro, Ovid and a few others, you will immediately see that the Romans did not even know what was going on and what their rituals meant! Mary Beard, the Cambridge scholar, has written extensively on this topic and her basic point is that the Roman reinterpreted their rituals to fit their current needs. In other words, meaning changed and was transformed based on context. As for the Shakespeare's play, the very fact that barren women are present suggests that they were looking for fertility. In the least, we can say that this was Shakespeare's interpretation.
At least originally, Roman men would run around naked during Lupercalia, hitting women (playfully) with thongs cut from goat skins. The belief was that getting hit by one of these would help a woman in the reproductive process. If she was pregnant, people believed, she would have an easier pregnancy. If she was not able to have children up to that point, she would be able to become pregnant after being hit.
This festival was supposed to have originated in prehistoric times and was connected to the idea that the founders of Rome, Romulus and Remus, had been suckled by a female wolf when they were babies.