Long before the trenches, "no man's land" was a real address in London, and a grim one.
Etymonline records the early 14th-century form Nonemanneslond as the name of an unowned patch of waste ground just outside the city's north wall, where executions took place. The wordhistories.net entry adds dates. A chronicle reports Lady Juliana burned there in January 1321, and another says the wine merchant Bernard of Spain was beheaded there for treason in November 1326.
The name was a plain description. The first element goes back to Old English nanne mon, an old way of saying "nobody," so the place was land no one held. Merriam-Webster dates the sense "unowned, unclaimed or uninhabited land" to the 14th century.
The same plot later served another purpose. During the Black Death in 1348 and 1349, wordhistories.net says, Bishop Ralph Stratford bought a plot called "no mans land," walled it and dedicated it for burials. John Stow, writing in 1598, claimed that more than 50,000 people were buried there, a figure he said he read in the charters of Edward III. Nothing checked here tests that number, so treat it as Stow's unverified claim.
By the 19th century the phrase had spread to ground of any kind that nobody controlled. Etymonline has uses from 1876 for a region claimed by two parties or by no one. Wordhistories.net cites Roderick Murchison, in an 1864 Royal Geographical Society address, describing a region of warring tribes as "a sort of No-man's-land." That is not military, and the figure also drifted into poetry, with Thomas Hood using it for an imaginary place in 1836.
The wartime sense is surprisingly recent. Etymonline says the meaning "terrain between the front lines of entrenched armies" is first recorded in 1908, then spread in the First World War. Britannica's description of the Western Front gives a sense of the scale: in places the opposing trenches were about 50 yards apart, or less.
So the phrase went from a literal wasteland, to a cemetery and execution ground, to a metaphor for contested land, to the most famous strip of ground in modern warfare.