In The Random House Historical Dictionary of American Slang, J.E. Lighter defines the term as prison lingo for ''an act of running or flight, esp. a dash to escape from custody.'' In his 1886 ''30 Years a Detective,'' Allan Pinkerton, the first ''private eye,'' explains an operation of pickpockets: ''After he secures the wallet, he will utter the word 'lam!' This means to let the man go and to get out of the way as soon as possible.'' Lighter cites do a lam, make a lam and take a lam early in this century, finally emerging as the passive state of being on the lam.
And the OED's information on its Scandinavian origin is echoed here:
Lighter speculates that it may be rooted in the dialect Scandinavian verb lam, as in the 1525 ''his wife sore lamming him,'' meaning ''to beat, pound or strike.'' Mark Twain used it twice: ''lamming the lady'' in 1855 and ''lam like all creation'' in 1865, both clearly meaning ''to beat.'' The suggested connection is that to avoid a feared lamming (related to slamming), one lams.
So this theory speculates that there's the verb lam first, attested by Mark Twain's use of the word in his books. Then possibly a new meaning evolved out of the verb: in order to not get lammed, one goes on the lam.
Other theories also exist:
RE: Splinterlands 101 - Ep 21: Behind The Avatar @misterrogers