Since neither one of them ever would talk about those days, whether they actually encountered one another is a matter for conjecture. I have imagined how such a contest might go, between a primordial demi-demoness in the earliest centuries of her growing power and a half-mad guerrilla warrior with an aegis of unguessed divine protection (aka "Doom"). We know that both of them survived that time to work greater havoc in the world, but I tend to think it would have been a very tense argument indeed.
The idea that Ungoliant's most powerful child might briefly dream of setting up as a chthonic goddess on her own, worshipped by mutants of magic and her own offspring, is mine — but suggested in part by the pathetic ideas of Gollum when he imagines making himself Ringlord at long last. "The Gollum! Eat fish every day, three times a day, fresh from the sea."
Additional thanks for story concepts are due to Kate Elliot, who has envisioned a multiple hunt as a contest of tribal leadership in her fantasy/AU Dark Ages series Crown of Stars, and of course to Jack London, master of the Survival Tale.
…and as he gazed her hair
within its cloudy web did snare
the silver moonbeams sifting white
between the leaves, and glinting bright
the tremulous starlight of the skies
was caught and mirrored in her eyes.
Then all his journey's lonely fare,
the hunger and the haggard care,
the awful mountains' stones he stained
with blood of weary feet, and gained
only a land of ghosts, and fear
in dark ravines imprisoned sheer—
there mighty spiders wove their webs,
old creatures foul with birdlike nebs
that span their traps in dizzy air,
and filled it with clinging black despair,
and there they lived, and the sucked bones
lay white beneath on the dank stones—
now all these horrors like a cloud
faded from mind. The waters loud
falling from pineclad heights no more
he heard, those waters grey and frore
that bittersweet he drank and filled
his mind with madness—all was stilled.
He recked not now the burning road,
the paths demented where he strode
endlessly…and ever new
horizons stretched before his view,
as each blue ridge with bleeding feet
was climbed, and down he went to meet
battle with creatures old and strong
and monsters in the dark, and long,
long watches in the haunted night
while evil shapes with baleful light
in clustered eyes did crawl and snuff
beneath his tree—not half enough
the price he deemed to come at last
to that pale moon when day had passed…
—Canto III, The Lay of Leithian
These wonderful lines from the fragment in The Lays of Beleriand describe in flashback Beren's southward trek in winter from enemy-occupied Dorthonion through the "Mountains of Terror" and the region beneath them through which Ungoliant had passed and corrupted with her poison, and her offspring who remained there, and which was further horribly affected by the interaction of her residual powers with Queen Melian's protective boundary girdling Doriath.
This is the place where in earlier centuries Aredhel the sister of Fingon and Turgon was separated from her escort en route between Gondolin and Aglon to visit the sons of Fëanor, and where the Haladin battled through on the way to Brethil — both sets of travelers undoubtedly lured by the promise of the smooth east-west road remaining from earlier Ages of peace before Morgoth's return to Middle-earth.
I wouldn't have presumed to try to better the descriptions of that appalling place full of mutated life-forms and tormented magic, nor the adventures of those who ventured there, as found in the Silmarillion and the Lay fragment, but a story idea was suggested to me by rereading The Two Towers, wherein it's remarked that Shelob dwelled there at the same time that Beren was struggling through — and instantly I wondered what would, or could, have happened if those two had collided.
We know that no one had managed to injure Her Ladyship badly before Samwise, and besides, that sort of Howard-style sword-swinging bravado doesn't match at all with the given characterizations of Beren as the solitary rebel ghosting through enemy camps, doing damage and fleeing, or laying low until pursuit passes by, even in the midst of conscious despair and disregard for his own safety — a survivor, whether he likes it or not.
Hence I posit him trying every possible non-confrontational way to get past her, until compelled to a plan that is only sane by comparison with the alternative. (We know from the conversation Sam overheard in Cirith Ungol that Her Ladyship will not take anything but live prey.) And I used this as a way of emphasizing the essential canniness and decisiveness of the Man who was rated as equal to the High King of the Eldar for a brief while on the hit lists of Angband, as well as to recollect the intriguing fact that Beren hails from a region once home to, and used as headquarters a place especially sacred to, the King and Queen of Doriath.
(It was also a technical challenge, in writing a viewpoint story from an essentially non-verbal perspective: since Beren has been living in almost total isolation from humanity while fighting his solitary war of vengeance and defiance against Morgoth for about four years, even before entering the mind-altering environment of the Ered Gorgoroth, there's no way, for instance, that I could do the sorts of things that I like to do, such as have characters note and remark upon the appropriateness of a sword named "Dark Battle" — ie, "ambush" — being used thus. It's still there, but far more subtley.)
So there is Fate here, in a large way, if obscurely represented, as well as Ages of history, in the persons of two who may be seen as respective champions of the Light and Dark sides in this encounter. Shelob is the scion of the Mother of Monsters, Arda's equivalent of Tiamat or Echidna, the slaughterer of the Two Trees, and a primordial demon of vast power — and in a day to come, she will menace other heroes who have set out on an impossible quest, aided and guarded by the descendents of Beren and Lúthien, who bear as protection against her some of the light of the same Silmaril that Beren will later win, given to them by the sister of the King who died aiding that first impossible quest.
But this is all speculation and conjecture, and not in any way to be considered any more than that, for it is nowhere said in Tolkien's writings that Beren ever crossed paths with the Child of Ungoliant, only a possibility allowed. I merely wish (as ever) to suggest, and to remind, and to bring about new and stronger appreciation for the originals.
—If the recollection of the spider-battles survived by the last Lord of Dorthonion not only serves to recall Third Age struggles (even as the hallowed moon-weapon was suggested by the lines quoted above, and the tortured trees by the pillars thus described during the later invasion of Morgoth's hall), but also to contrast two very different kinds of webs and snares, natural and enchanted, and to remind the reader of that lesson of Middle-earth, that Good too can be dangerous, and though dangerous, and permanently changing, that which is magical and Other can be Good — so much the better.