Doc Brown's Entire Back To The Future Timeline Explained
After leaving the DeLorean for Marty and becoming a blacksmith but before meeting Clara, Doc rescues Marty from Mad Dog and his gang. (They were going to hang him, partially because of the outfit that 1955 Timeline E Doc picked out for him.) Initially, Doc is irritated that Marty traveled back for him, rather than returning to 1985 as he instructed, but after learning about his death in Timeline F, he agrees to return with Marty.
However, returning to 1985 proves easier said than done, since Marty nicked a fuel line in the time machine when he arrived in 1885, and there aren't exactly an abundance of gas stations in the Wild West. Without a way to self-propel the car, Doc hatches a plan to hijack a train and use the engine to push the DeLorean up to the necessary 88 miles per hour. However, after Clara and Doc meet and fall in love, she attempts to follow Doc onto the speeding train and winds up nearly taking a catastrophic tumble onto the tracks.
Instead of joining Marty in the DeLorean, Doc makes a split-second decision to save Clara instead, missing his window to return to the future. Marty goes back to the future alone, and Doc remains in 1885 with Clara. Fortunately, before stealing the train, Doc and Marty foiled Mad Dog's plans to kill Doc, enabling Doc and Clara to live their lives free of tragedy.