indefinite article before words beginning with vowels, 12c., from Old English an (with a long vowel) "one; lone," also used as a prefix an- "single, lone;" see one for the divergence of that word from this. Also see a, of which this is the older, fuller form.
In other European languages, identity between indefinite article and the word for "one" remains explicit (e.g. French un, German ein, etc.) Old English got by without indefinite articles: He was a good man in Old English was he wæs god man. Circa 15c., a and an commonly were written as one word with the following noun, which contributed to the confusion over how such words as newt and umpire ought to be divided (see N).
In Shakespeare, etc., an sometimes is a contraction of as if (a usage first attested c.1300), especially before it.