During the middle ages, no man's land was located outside the north wall of the city of London, where criminals were displayed. Since even minor crimes were punishable by death, there were plenty of bodies--hanged, beheaded, impaled--to serve as a warning for others.
Eventually, a gallows was built inside the city proper. Years passed, and all around London land was settled and fields were cultivated--except for the former execution grounds, which were claimed by no man. No man's land was the term used to describe the area, and only later, around 1900, was the phrase picked up in military parlance.