This bizarre incident is related to the gemara in Yevamot 60b, in which Rav Kahana claims the virgins of Yavesh Gilad from Judges 21:12 were determined as such through their breath while on a barrel of wine.
The Maharsha (R. Shmuel Eidels, 1555 – 1631) understands this scenario as linking promiscuity with drunkenness:
הכתוב שהוא מורה על הזנות ועבירה דבתולות כמ"ש זנות ויין וגו' ותירוש ינובב בתולות וק"ל
This teaches about harlotry and the transgression of virgins, as it is written, "harlotry and wine [and new wine take away from the heart]" (Hos. 4:11) and "new wine will cause maids to speak" (Zec. 9:16), which is easy to understand.
Maharsha appears to argue that a woman who transgresses by getting drunk off wine indicates that she is not considered a virgin; that drunkenness means harlotry. This reading would not consider the non-anatomic claim of barrels, which he seems to support in the scriptural passage linking maids speaking from new wine (read: over barrels of wine).
If you're looking for more explicit symbolism, R. Yaakov Shulevitz, in his commentary Chevruta, links the barrels to the hymen:
הושיבום על פי חבית של יין, ומי שהיתה בעולה, ריחה של חבית היין נודף ממנה, כיון שפיתחה למטה פתוח, ומי שהיתה בתולה, ופיתחה סתום - אין ריחה נודף
They sat them on the opening of a barrel of wine, and the one who was a non-virgin, her breath would smell like the wine from the barrel of wine - meaning to say that her opening below was open, and for the virgin it would be closed, or "her breath did not smell like wine" (Yevamot 60b)
Here, R. Shulevitz seems to suggest a symbolic equivalence (or perhaps a euphemism), in which the virgin's hymen is likened to a barrel of wine, unbroken and preserved. One might further link the color wine to the blood that chazal mark as an indicator of non-virginity, a euphemism for orifices, or perhaps that sitting on a wine barrel allows for an easier inspection.
Whatever the case, if understood literally, it should be noted that a simple reading of the rest of this gemara illustrates that this practice is disturbing. As the scholar Michael Rosenberg writes in his work Signs of Virginity: Testing Virgins and Making Men in Late Antiquity:
The fact that the sage needed to verify the tradition he had received for testing virginity...introduces doubt to the reader's mind. Rabban Gamliel b. Rabbi had "heard" of this tradition, but he had never "seen" it put into practice. If this tradition might not be reliable, what other received practices for determining a woman's virginity might not be reliable?...And the anonymous editorial voice, again in Aramaic (as opposed to the rest of the story), makes this doubt explicit: the reason Rabban Gamliel b. Rabbi added this step in the process, we are told, is because "perhaps this method is not sufficiently reliable." This, Rabban Gamliel b. Rabbi's barrel test is at one and the same time "objective" and anxiety-inducing.