The odd marathon distance comes from a castle in London.
At the first modern Olympics in 1896 the marathon was about 40 kilometres, and the distance varied afterwards. In London in 1908 the race started at Windsor Castle and finished in front of the royal box in the stadium: 26 miles and 385 yards, or 42.195 kilometres. In 1921 the athletics world federation made exactly that length the standard.
Useful: Many "eternal" standards are frozen accidents from a single event.
Source: en.wikipedia.org