The first usage relative to prisons was in a February 13th, 1930 theatrical production of "The Last Mile" by John Wexley. It was mentioned the following day in a review in the New York Times.
The term "last mile" was derived from the combination of the words "last" and "mile", obviously. What may not be so obvious is the meaning of "mile" (an arbitrary distance, chosen to denote a degree of difficulty).
The idiom: "Before you judge a man, walk a mile in his shoes" was almost certainly is derived from a Mary T. Lathrap poem published in 1895.
The original title of the poem was "Judge Softly", later titled "Walk a Mile in His Moccasins" (likely because the expression was mentioned many times throughout the poem).
There are many variations on the phrase such as walk a mile in his, her or my shoes. A plea for empathy is phrased put yourself in my shoes, as well as put yourself in his or her shoes.
Why do people use the term "mile" to describe difficulty?
In the book "Image and Environment: Cognitive Mapping and Spatial Behavior" by David Stea the author explains people's perception of, and judgment or estimation of, various distances and how they are cognitively mapped:
A model of spatial cognition
... Initially, we must distinguish between objective physical space and individual space. The characteristics of objective physical space are defined on the two-dimensional Euclidean plane. ...
Through the process of perception as it modifies, and in turn is modified by, learning and thinking, the organism obtains information about physical space. This information generates both an image of a particular environment with which the individual has had direct experience and a set of generalized cognitive categories against which perceptual inputs from new environments can be compared and thus identified, organized, and given meaning.
The physical space of a city is learned over time in three ways : (1) through behavior in which information is gained directly from the city structure through the visual, auditory, olfactory, and kinaesthetic sense modalities; (2) from symbolic representations of the city using visual media such as maps, photographs, and written words; and auditory media such as spoken words or recordings; (3) from ideas about parts of the city which have not been gained through behavior or symbolic representations, but are inferred from experiences in other spatial locations (see chaps. 4, 6, and 15). Knowledge so learned is spatially discontinuous compared with the objective physical space of the Euclidean plane.
This knowledge may be organized into a hierarchy in which knowledge of higher levels is partly dependent upon, and in turn is influenced by, knowledge of the lower levels.".
David Stea's position being that many people perceive distances in bits and pieces mapped together to derive an estimate without an precise measurement being considered, particularly at larger distances; and based upon their environment and experiences.
This supports the position that people whom are not surveyors (or others with practice in precise distance measurement) throw around terms like "a mile" without an exact correspondence to either distance nor the environment as experienced by another person.
Premise offered by @user159691: "The expression last mile appears to have been first used in a figurative sense in relation to capital punishment".
Saul Levitt (born March 13, 1911), is whom you attribute to the 'first usage', but in the article "Why Are Marathons 26.2 Miles Long?" by Dan Peterson he writes:
"After 1896, the next few Olympic marathons varied in distance with the idea that as long as all runners ran the same course, there was no need to keep the distance exactly the same.
For the 1908 London Olympics, the course was laid out from Windsor Castle to White City stadium, about 26 miles. However, to locate the finish line in front of the royal family's viewing box, an extra 385 yards was added inside the stadium. Hence the marathon tradition of yelling "God save the Queen" in the last mile.
Despite the success of that first race, it took 13 more years of arguing before the International Amateur Athletic Federation (IAAF) adopted the 1908 distance as the official marathon. In fact, of the first seven modern Olympics, there were six different distances.".
Other Sources: "Galloway's Marathon FAQ: Over 100 of the Most Frequently Asked Questions" by Jeff Galloway and "Practice Makes Perfect: Level 7: Preparation for State Reading Assessments" by Sondra Y. Abel.
In the book "Historical Dictionary of Contemporary American Theater: 1930-2010" by James Fisher the noun "last mile" is mentioned "in relation to capital punishment" in the description of the theatrical production "The Last Mile" on page 450:
450 • LAST MILE, THE
LAST MILE, THE. A naturalistic prison drama, The Last Mile opened on 13 February 1930 at the Sam H. Harris Theatre, starring a young SPENCER TRACY in the dynamic leading role of John "Killer" Mears, a tough inmate on death row who leads his fellow prisoners in a riot to protest prison conditions. JOHN WEXLEY'S play won critical acclaim and ran for 289 performances, with subsequent touring productions (including one starring Clark Gable) and film versions in 1932 and 1959. The sensation caused by The Last Mile led to a spate of prison-themed plays and films and, more importantly, to prison reform and heightening debate over the viability of the death penalty.
- When did the usage of “last mile” in relation to capital punishment start? and did it originally refer to a real distance?
John Wexley probably came up with the idea of applying prior usage to capital punishment prior to his theatrical production The Last Mile on 13 February 1930.
In death penalty parlance, the distance between death row and the death chamber is called the last mile.
Neither prisons nor theaters involve a mile long walk for the condemned.
- Is the later figurative usage (communications/commerce) related to the previous one or does it have a different origin?
Related?, as an exaggeration.
I'm not aware of reports of a direct correlation between working on the last mile of cabling or delivery being a death sentence, though it's obviously possible that it has occurred.
It's possibly a confusion about the often quoted statistic that "most accidents involving motor vehicles occurring within 5 blocks of one's home (only barely so, at 52%, and most are not fatal; unlike accidents occurring over 5 miles from one's home which are more likely so).".
The expression "last mile" should simply be thought of as "the most difficult part", that way it's applicable to the majority of correct usages.
Related usage "The Longest Yard", a movie where prison inmates play football against their guards. The implication of the film's title was that getting the last yard was the most difficult part, arguably it wasn't.