As a conjunction, "previous to the time when," from c. 1200. Contrasting before and after in illustrations is from Hogarth (1768). Before the mast in old sailing ship jargon in reference to the life of a common sailor is from the place of their berths, in front of the fore-mast.
Old English lang "having a great linear extent, that extends considerably from end to end; tall; lasting," from Proto-Germanic *langa- (source also of Old Frisian and Old Saxon lang, Old High German and German lang, Old Norse langr, Middle Dutch lanc, Dutch lang, Gothic laggs "long").
The Germanic words perhaps are from PIE *dlonghos- (source also of Latin longus "long, extended; further; of long duration; distant, remote," Old Persian darga-, Persian dirang, Sanskrit dirghah "long"), from root *del- (1) "long" (source also of Greek dolikhos "long," endelekhes "perpetual"). Latin longus (source of prolong, elongate, longitude, etc.) thus is probably cognate with, but not the source of, the Germanic words. The word illustrates the Old English tendency for short "a" to become short "o" before -n- (also retained in bond/band and West Midlands dialectal lond from land and hond from hand).
Also in Old English in reference to time, "drawn out in duration," with overtones of "serious." The old sense of "tall" now appears to be dialectal only, or obsolete. For long "during a long time" is from c. 1300. To be long on something, "have a lot" of it, is from 1900, American English slang. A long vowel (c. 1000) originally was pronounced for an extended time. Mathematical long division is from 1808. Sporting long ball is from 1744, originally in cricket. Long jump as a sporting event is attested from 1864. A long face, one drawn downward in expression of sadness or solemnity, is from 1786. Long in the tooth (1841 of persons) is from horses showing age by recession of gums (but not in this sense until 1870). Long knives, name Native Americans gave to white settlers (originally in Virginia/Kentucky) is from 1774, perhaps a reference to their swords. Long time no see, supposedly imitative of American Indian speech, is first recorded 1919 as Chinese English.
parting salutation, 1860, of unknown origin, perhaps from a German idiom (compare German parting salutation adieu so lange, the full sense of which probably is something like "farewell, whilst (we're apart)"); or perhaps from Hebrew shalom (via Yiddish sholom). Some have noted a similarity to Scandinavian leave-taking phrases, such as Norwegian Adjø så lenge, Farvel så lenge, Mor'n så lenge, literally "bye so long, farewell so long, morning so long;" and Swedish Hej så länge "good-bye for now," with så länge "for now" attested since 1850 according to Swedish sources. Most etymology sources seem to lean toward the German origin. So long (adv.) "for such a long time" is from late Old English.
Earlier guesses that it was a sailors' corruption of a South Pacific form of Arabic salaam are not now regarded as convincing. "Dictionary of American Slang" also adds to the list of candidates Irish slán "safe," said to be used as a salutation in parting. The phrase seems to have turned up simultaneously in America, Britain, and perhaps Canada, originally among lower classes. First attested use is in title and text of the last poem in Whitman's "Leaves of Grass" in the 1860 edition.
An unknown sphere, more real than I dream'd, more direct, darts awakening rays about me — So long!
Remember my words — I may again return,
I love you — I depart from materials;
I am as one disembodied, triumphant, dead.
Whitman's friend and fan William Sloane Kennedy wrote in 1923:
The salutation of parting — 'So long!' — was, I believe, until recent years, unintelligible to the majority of persons in America, especially in the interior, and to members of the middle and professional classes. I had never heard of it until I read it in Leaves of Grass, but since then have quite often heard it used by the laboring class and other classes in New England cities. Walt wrote to me, defining 'so long' thus: "A salutation of departure, greatly used among sailors, sports, & prostitutes — the sense of it is 'Till we meet again,' — conveying an inference that somehow they will doubtless so meet, sooner or later." ... It is evidently about equivalent to our 'See you later.' The phrase is reported as used by farm laborers near Banff, Scotland. In Canada it is frequently heard; 'and its use is not entirely confined to the vulgar.' It is in common use among the working classes of Liverpool and among sailors at Newcastle-upon-Tyne, and in Dorsetshire. ... The London Globe suggests that the expression is derived from the Norwegian 'Saa laenge,' a common form of 'farewell,' au revoir. If so, the phrase was picked up from the Norwegians in America, where 'So long' first was heard. The expression is now (1923) often used by the literary and artistic classes.
also long-shot, in the figurative sense of "something unlikely," 1867, from long (adj.) + shot (n.). The notion is of a shot at a target from a great distance, thus difficult to make. The phrase by a long shot "by a considerable amount," frequently negative, is attested by 1830, American English colloquial. The cinematic sense of the noun phrase is from 1922. As an adjective by 1975.