1834, from the adverbial phrase, "far away in past time;" see long (adv.) + ago. As a noun from 1842.
Entries linking to long-ago
long adv.
Old English lange, longe "for a length of time, a long time; far, to a great extent in space," from long (adj.). Old English also had langlice (adv.) "for a long time, long, at length." Longly (adv.) is rarely used. No longer "not as formerly" is from c. 1300; to be not long for this world "soon to die" is from 1714.
ago adj.
"gone, gone by; gone away," early 14c., a shortened form of agon "departed, passed away," past participle of a now-obsolete verb ago, agon "to go, proceed, go forth, pass away, come to an end," from Old English agan. This was formed from a- (1) "away" (perhaps here used as an intensive prefix) + gan "to go" (see go (v.)).
As an adverb, "in past times" (as in long ago) from late 14c. The form agone is now obsolete except as a dialectal variant.