I’ve combined these two words into one entry because they were names for similar things, and both are now obsolete. They both refer to types of vinegar formed by fermentation of ale or beer.
It’s obvious enough where the first part of each of these names comes from — ale and beer. The second half, which both share with vinegar, the related fermented product made from wine, is the French word aigre, sour.
Of the words, alegar was much the more common, even though the product was mainly brewed from sour beer rather than from ale (the difference is that ale was made without hops or with only a very small amount). Both products came into English during the late Middle Ages, their names being recorded first about 1500, and became well-known preserving agents, often as a mixture with salt and spices. But they were fiery products, much fiercer on the palate than the milder wine vinegar. An Italian visitor to England during the first Elizabeth’s reign noted sadly that all salads were drowning in alegar, with nothing added to modify its raw ferocity.
Neither word has ever been well known in North America, where its modern equivalent that goes by the name of malt vinegar is also uncommon (malt because the beer it derives from is made from malted barley).