This question was posted in 2011, but apparently there had been studies on the etymology of this term that haven't been discussed in existing answers. There is a 1998 article on this exact topic in The New York Times Magazine: On Language; On the Lam, Who Made Thee? By WILLIAM SAFIRE, MARCH 1, 1998:
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:
At the University of Missouri at Rolla, Gerald Cohen, a professor of foreign languages currently at work on a slang dictionary, has another theory. He notes the cant lammas in Eric Partridge's Dictionary of the Underworld, the lingo of costermongers in London around 1855, alternatively spelled nammou, meaning ''to depart, esp. furtively'' and related to vamoose in the lingo of the American West.
''Namase with its variant spellings,'' Cohen says, ''was the standard cant term for 'leave/make off/depart/skedaddle.' I don't know why nam became lam, but the meanings are the same.''