I know that old Icelandic cuisine in particular involves pickled fish and ray. How did ancient and medieval produce vinegar?
If wine, beer, cider, and other 'dilute' alcohols are left to the open air they will sour and turn into vinegar...so vinegar makes itself! The distinctive taste of vinegar comes from acetic acid which produced by the conversion of alcohol by bacteria into acid.
Vinegar was a popular condiment and dressing, and used for pickling. Late medieval cooking and house keeping books (the first examples we have from the medieval period) suggest that the 'souring' or 'spoiling' of wine, beer and alcohol was a constant problem. It stands to reason that they probably had a lot of vinegar. This volume was a byproduct of the production and poor (not airtight) storage methods: alcohols were generally consumed while fresh and young because they would go off rapidly.
It also stands to reason that vinegar was deliberately produced for purposes of preserving foods for off season.
Any acidic solution can serve as a vinegar for pickling. Although wine is a feasible pickling option for northern Europe, particularly at the height of the Roman Empire, it would have been very expensive use of a luxury import. Some grape or wine vinegar (possibly like balsamic) was probably imported to legionary posts to make the soldiers' brew called posca, which was meant to be a cheap alternative to wine, but it's unclear whether this Mediterranean staple would have circulated beyond the garrison towns, or if anyone in Northern Europe would have wanted it.
Malt vinegar, which is made from barley beer, is a more likely option. Apple cider vinegar is also a possibility, although it should be remembered that apples in medieval Europe were closer in flavor to crab apples than to our modern supermarket selection. I'm not sure how this would have affected flavor. Both these options would have taken quite a while to prepare, so I'm personally dubious that they would have been used. These vinegars would not have been ready until long after harvest whereas pickling needed to be done at the harvest time to preserve fruits, vegetables, and the winter slaughter.
The most common pickling solution in medieval Northern Europe was probably whey or sour milk. Once milk goes from being slightly sour to curdling (what most people today would consider "going bad"), the curds can be made into cheese and the leftover whey would be used for drinking or cooking. Pickling would likely occur in the months leading up to winter, at the same time that households would be making cheese, so whey would be a readily abundant acidic preservative, especially in a dairy society like premodern Ireland.
Reconstructing premodern recipes is tough, but I've been very impressed by An Early Meal by Daniel Serra and Hanna Tunberg. Serra runs a Facebook page and also has a defunct blog full of information, including his first insights into using whey as a vinegar.