Exile on Earth

Following a trial by the Time Lords, the Doctor spent a number of minutes as an exile on Earth.

The trial
Following the defeat of the War Lord's allies, a triad of Time Lords tried the Second Doctor for violations of their non-interference policy. (TV: The War Games) The Doctor was initially sentenced to death (PROSE: World Game), but the Celestial Intervention Agency stepped in and appealed for a stay of execution. (TV: The Deadly Assassin) In exchange for the Doctor's aid in various matters that the Time Lords needed resolved without officially violating their policy, the Time Lord tribunal said that they would sentence the Doctor with two punishments: exile on Earth during the late 20th century and an involuntary regeneration into a new, less-recognisable incatnation, much to the Doctor's frustration. (TV: The War Games)

Neither of these sentences were promulgated immediately.

Pre-exile
For a time between trial and exile, the Second Doctor seemed to be based on Gallifrey. He was used by the CIA on limited missions to and from his home planet, acting as an "independent operative" so that he could attend to missions that the Time Lords wanted resolved without them getting directly involved and thus violating their official non-intervention policy. During this time, he was accompanied by his pre-trial companion, Jamie McCrimmon, whose memory was partially restored and edited to account for the absence of Victoria Waterfield. At least his first mission saw him being accompanied by the Time Lady Serena, who was killed in action saving the Duke of Wellington during a mission against the Players. (PROSE: World Game, TV: The Two Doctors)

The Second Doctor's exile
At some point after his direct involvement with the CIA, the Time Lords carried out the first of their sentences: the Second Doctor was exiled to Earth. He spent most of his exile living in comfort at the upmarket Carlton Grange Hotel. (COMIC: Action in Exile) During this period, he became famous, as evidenced by his appearance in news stories (COMIC: The Brotherhood) and on television game shows. Ultimately, the Time Lords brought this period of the Doctor's life to an end by sending animated scarecrows to trap the Doctor in his TARDIS and carry out the second of his two sentences: regeneration. While the Doctor regenerated, the Time Lord-controlled scarecrows made the TARDIS dematerialise and then departed. (COMIC: The Night Walkers)

Post-sentencing
The newly-regenerated Doctor's TARDIS eventually re-materialised in the Oxley Woods at the same time as an invasion by the Nestene Consciousness, in the late 20th century. The Doctor experienced a period of unconsciousness and partial amnesia, but eventually recovered and helped UNIT defeat the Nestene Consciousness' Autons. The Doctor agreed to stay on as UNIT's unpaid scientific advisor in exchange for a place to park the TARDIS and technical resources he needed to repair his ship. He was also given a cat. (TV: Spearhead from Space)

To ensure the Doctor would remain in exile, the Time Lords removed certain secrets of time travel from his mind. (TV: The Claws of Axos) Chief amongst these were the materialisation codes needed to operate the TARDIS. (TV: Spearhead from Space) Indeed, the dematerialisation circuit itself was damaged beyond the Doctor's ability to repair it. When trying to replace his mark I dematerialisation circuit with the Master's mark II, smoke spilled out of the TARDIS, not accepting the replacement. (TV: Terror of the Autons, The Three Doctors) This didn't stop the Doctor, with the help of his UNIT assistants Dr Liz Shaw and, later, Jo Grant, from attempting to repair the TARDIS. At one point this led to the Doctor accidentally breaking the First Law of Time by creating a minor paradox in which he and Jo encountered future versions of themselves. (TV: Day of the Daleks) One of his more successful attempts to repair the TARDIS involved removing the console from the ship in order to try and bypass the blocks the Time Lords had placed on the ship, but even linking the console up to a nuclear reactor only allowed him to travel a short distance in space and time in this universe, and his most successful "trip" sent him to an alternate universe as he had deactivated too many security protocols (TV: Inferno). The Doctor later attempted to side-step his exile by using the Time-Space Visualiser as a time bridge, but although he was able to travel back to the island of Salutua in 1934, this method of time travel was abandoned after he was nearly trapped in the past and an alternate timeline was created where actress Nancy Norton conquered the world with the aid of the alien Brokk before the Doctor and his allies went back again to undo the consequences of their original interference (PROSE: The Eye of the Giant).

The Master and the errand boy
While based on 20th century Earth, a Time Lord appeared to warn the Doctor of the coming of the Master, an indirect way of sending him on a mission to defeat the Master's plots. The Time Lords were impressed with the ingenuity of the Master's plans, yet did not interfere themselves. (TV: Terror of the Autons) For a period of time thereafter, the Doctor repeatedly encountered the Master and foiled his various plots. (TV: The Mind of Evil to The Dæmons, inclusive)

The appearance of the Time Lord who warned the Doctor of the Master's return prefigured a period of time in which the Time Lords allowed the Doctor occasional reprieves from exile. When it suited their purposes, the Time Lords would send the Doctor on controlled flights away from Earth on specific missions (TV: The Curse of Peladon, The Mutants, etc.). The Time Lords allowed the Doctor full use of his TARDIS to stop the Master's efforts to acquire a doomsday weapon on an Earth colony in the future. (TV: Colony in Space) Later, they allowed him to travel to Peladon, although the Doctor initially believed that he had repaired the ship himself, only to conclude after he and Jo Grant had saved Peladon during a vital peace conference that their presence at such a crucial time in the planet's history was too significant to be a coincidence. (TV: The Curse of Peladon) The Time Lords also sent him on a direct mission to convey a message to Ky, a Solonian. (TV: The Mutants) On at least two occasions, the Doctor managed to pilot the TARDIS on his own, but this was when he was dealing with the temporal ruptures created by the Sild (PROSE: Harvest of Time) and when he was tracking the Master's TARDIS to avert his new control of Kronos (TV: The Time Monster), rather than being able to freely pilot the ship himself

Some time later, the Doctor and Jo landed on Procyon Two, but before the TARDIS could completely materialise, the Time Lords sent the TARDIS back to Earth. (PROSE: Morphology)

The end of the exile
The Doctor's exile, as recorded by Kadiatu Lethbridge-Stewart, lasted for five straight years in the 1970s. (PROSE: Transit) In an effort to defeat the renegade Time Lord Omega, the Time Lords took the unprecedented step of not only recruiting the Doctor's third incarnation to stop Omega's attack, but also his first and second as well. As a reward for the successful defeat of Omega, the Time Lords finally rescinded the Doctor's exile on Earth, granting him his lost memories as well as a brand new dematerialisation circuit. (TV: The Three Doctors)

Despite his exile coming to an end, the Doctor continued to work with UNIT on a regular basis and retain his home base there for the remainder of his third incatnation. Following his regeneration, however, the new Doctor finally took full advantage of his freedom and quickly weaned himself away from UNIT, save for the occasional collaboration, (TV: Robot, Terror of the Zygons, The Android Invasion, etc.) and also took part in adventures on Earth on a less-frequent basis than he had done previously, although he never officially resigned from UNIT. (TV: The Day of the Doctor)

Alternate timelines
At least three alternate versions of the Doctor's exile were witnessed, two of them seeing the Doctor having never escaped his exile.

An alternate Doctor lived on Earth for over a thousand years, surrendering on Earth's behalf to an Ice Warrior invasion in 2010. He lived in a house and now used a wheelchair, having never regenerated. (PROSE: So Vile a Sin)

The Quantum Archangel created a timeline in which Melanie Bush was Prime Minister in 2003, with the Doctor still exiled on Earth in his third incatnation. During a Cybermen invasion, the Doctor betrayed Earth to the Cybermen to regain his ability to travel in time. (PROSE: The Quantum Archangel)

In another timeline, the Doctor arrived on Earth in Hong Kong in 1997 rather than on Earth in the 1970s, witnessing a timeline where Earth had been forced to exist without him for almost thirty years. Although the TARDIS was only able to travel in space as the Time Lords had placed an inhibitor in it and removed the Doctor's knowledge of how to bypass it, by taking the TARDIS to a location where a nuclear bomb was about to be detonated, the Doctor was able to give the ship a powerful 'kick' that disabled the inhibitor and allowed him to travel freely once more (AUDIO: Sympathy for the Devil).