The Doctor's trial (The War Games)
In the Doctor's first trial involving the Time Lords he was charged with breaching the non-interference policy.
Judging the return of the participants in the War Games too tough a task, the Second Doctor decided to send a hypercube containing all the relevant information to the Time Lords so that they could help with the matter, although the War Chief quite forcibly advised against it. The Doctor briefly attempted to evade the Time Lords but they took control of the TARDIS and landed it on Gallifrey. The Doctor, Jamie and Zoe witnessed the War Lord being sentenced before Jamie and Zoe were placed in a force field and the Doctor was escorted to his own trial.
The Time Lords accused the Doctor of breaking their laws of non-interference. The Doctor admitted the crime and reiterated his pride in doing so, rather than merely observing the evil in the universe. He then asked for a Thought Channel to show the evil he fought. He showed the Time Lords the Quarks and the Yeti. When they seemed unimpressed he showed them the Ice Warriors, the Cybermen and the Daleks. He ended by saying that he may be guilty of interference, but they were guilty of passivity against such evil. With the trial over, the Time Lords considered the charges whilst the Doctor played cards.
Allowed to bid farewell to Jamie and Zoe they convince him to try and escape but they are intercepted by a group of Time Lords. The Doctor says goodbye to both of them before they are returned to their own times with their memories wiped of all but their first encounter with the Doctor. The Doctor watched on a screen as Zoe is returned to the Wheel and Jamie fights a Redcoat.
The Time Lords then delivered their verdict; they accepted that there was evil in the universe that must be fought and the Doctor had a part to play. They noted his affinity to Earth and told him he would be exiled there as well as forced to regenerate. The Time Lords gave the Doctor several choices for his new body but he declined all of them. He then lost his speech and began to swirl into nothingness. (TV: The War Games)
Before the Doctor's sentence could be carried out, the Celestial Intervention Agency intervened and turned him into their "hired gun". (PROSE: World Game) He would work in this capacity for some time. (TV: The Two Doctors et al.) However, when the CIA needed to cover up his visit to Space Station Camera it was decided that his exile should be enforced. (PROSE: A Brief History of Time Lords) Although the Doctor escaped again before a regeneration could be enforced and lived in luxury for some time before falling into a trap and finally regenerating into his third incarnation. (COMIC: The Night Walkers)
Both Jamie (COMIC: The World Shapers) and Zoe were able to regain some of their memories of travelling with the Doctor. (AUDIO: Echoes of Grey) Additionally, after the Doctor had saved the Time Lords from certain doom they lifted his exile and restored his knowledge of the TARDIS. (TV: The Three Doctors) This trial was referenced during the Sixth Doctor's trial for meddling, in which the sentence was deemed by the prosecutor to be too lenient. (TV: The Mysterious Planet)
Alternate timelines
In a parallel universe, the Second Doctor chose one of the faces offered to him and became a brutal dictator on Earth. (PROSE: Timewyrm: Revelation)
Behind the scenes
The concept of a Season 6B set between The War Games and Spearhead from Space was a long held fan theory and established as narrative fact by TV Comic.
In the fan film, Devious, the Doctor was extracted by the CIA halfway through his regeneration creating the "Second-and-a-Halfth Doctor" played by Tony Garner. He went on several adventures before completing his regeneration.