The longest retreat is the Long March
The retreat lasted over a year and went almost 10,000 km.
The Communists, under the eventual command of Mao Zedong and Zhou Enlai, escaped in a circling retreat to the west and north, which reportedly traversed over 9,000 kilometers (5600 miles) over 370 days
Most people are familiar with the outline of this retreat - essentially,
the Chinese Communist Party (CCP) had establish an un-recognized governance over parts of Jianxi and Fujian .
The GMD attacked, and the CCP fled to join with communist forces in north China.
They settled in Baoan
history.stackexchange.com/users/17888/axsvl77
Napoleon in Russia is the longest clear retreat.
Its the longest regular army retreat, at least 490 miles.
The Anabasis is considerably longer, but it is not corroborated.
There are a few massive countries like Canada or Australia, but they haven't had major wars on their territory.
The only other countries to even approach that kind of length are China and India, neither of which seem to have any notable retreats across their length - besides insurgencies like the Long March, as the other answer has already found.
List of Chinese wars and battles List of Indian battles
You could also consider situations like the defeat of the Africa Korps to be a retreat, but it was more of a delaying action and doesn't clearly qualify.
The reason why Napoleons' retreat was unique was, firstly, because his army was much larger and better supplied than medieval and ancient militaries, and secondly because Russia was late to industrialize and did not have the logistical ability to pursue him.
This is an unusual combination that does not happen often.
history.stackexchange.com/users/None/
The retreat of the Nez Perce under Chief Joseph in 1877 is a good candidate: a fighting retreat in good order, covering a distance that is variously described as anything from about 1,150 to 1,500 miles (1850 to 2400 km).
(I have seen claims that this was taught to US Army and Marine officers, at least as recently as the Vietnam War era, as an exemplar of a well-conducted fighting retreat.)
history.stackexchange.com/users/17193/Peter Erwin
There's also the march of the Czech (or Czechoslovak) Legion in 1918, after the October Revolution and the Treaty of Brest-Litovsk.
The Legion was formed as a unit in the Russian Army composed of Czechs and Slovaks interested in freeing their compatriots from Austro-Hungarian rule.
When the Bolsheviks started making peace with the Central Powers, the Czech Legion decided to rejoin the war on the Allied side, which basically meant getting to France.
Since getting through the German-controlled Baltic looked dubious, they decided to exit Russia via Vladivostok, in the Siberian Far East.
The march started as a retreat in the face of German and Austro-Hungarian forces invading the Ukraine (part of a move to pressure the Bolsheviks into agreeing to the Treaty of Brest-Litovsk), and effectively ended 6,000 miles (9,700 kilometers)
later in Vladivostok, which makes it a little bit longer than the Long March.
All the same, I'm not sure how much of this qualifies as a retreat per se, since for much of the time they were more on the offensive than anything else (seizing control of multiple cities along the railway route, for example).
It's probably more an example of a (very extended) march through hostile territory.
history.stackexchange.com/users/17193/Peter Erwin
Consider Anabasis of Cyrus, described by Xenophon.
history.stackexchange.com/users/466/Anixx
If we are talking re regular troops then the British Commonwealth retreat to the Japanese on 1942 should be considered.
I can't find an exact distance but History learning site gives this as 1000 miles.
This would have been equalled by the 1944-5 campaign that saw the Japanese retreat that distance although that retreat ended with the whole army destroyed and the British forces being able to go further which the Japaese weren't able to do in 1942, Map from United States Army Center for Military History
history.stackexchange.com/users/2510/mmmmmm
What is the longest sustained retreat by a military force in history, by total length? Not counting naval examples, as they can be much longer.  When I search for it I get a lot of results to the  Battle of the Ch'ongch'on River , which is the longest retreat in  US history , but at 120 mi (190 km) it is dwarfed by a more famous retreat, of the  French from Moscow .  Still, that may not be the longest in all history. Which one is the longest?
What is the longest retreat?
history.stackexchange.com
<military><warfare>
history.stackexchange.com/questions/32793
history.stackexchange.com/users/2957/congusbongus
They are lots of candidates for the longest retreat in history: the Long March, Napooleon in Russia, the Anabasas of Cyrus, Nez Perce in 1877, the Czech Legion in 1918 after the October Revolution and the British retreat to the Japanese in 1942. It is unclear which is the longest retreat in history, but strong contenders include The Long March, Napoleon's retreat from Russia or the retreat of Anabasis of Cyrus.
It is unclear which is the longest retreat in history, but strong contenders include The Long March, Napoleon's retreat from Russia or the retreat of Anabasis of Cyrus.