Not sure I can give an answer long enough to be adequate for the subreddit, but to the best of my knowledge they had no way of dealing with it except by either dying, or, if surviving an attack and guessing right for the cause, avoiding it the allergen.
Now, this probably happened more rarely than you might think, as for most of human history food was produced locally for the vast majority of the population. So if you were allergic to a local ingredient you died young, the cause as poorly understood as for the rest of child and infant mortality.
If you were not allergic to something in your environment, well, an inland family of farmers can thrive for many generations blissfully unperturbed by an allergy to shrimp. And travellers would encounter new and interesting diseases to die from anyway so it might not stand out. One may speculate that some tales of people poisoning strangers were unfortunate encounters with new allergens, but we don't know.
Source ; being a biologist with an interest in history.