Querelle's answer above is a nice idea, but not really accurate, I'm afraid. A jar was originally an earthenware container for holding oil and other liquids and later took on the meaning of a specific quantity of 20 gallons. Not until the 1920s did it take on the joking, colloquial sense of a drink of beer.
The earliest recorded use of the word in this way was in Sean O'Casey's play Juno and the Paymale-bird. (Of course, I refer to a word which opens with c and ends in ock!) Bentham doesn't understand what Boyle means by a wet, so Boyle replies, "A wet - a jar - a boul!" We've used it thus ever since.