The Doctor and Jamie first meet Zoe Heriot aboard The Wheel in Space, a space station where she serves as head librarian. It just so happens that the Cybermen have an interest in this particular Space station, and Zoe aids the Doctor in fending off their attack. At the end of this adventure, Zoe ends up stowing away aboard the TARDIS in order to gain the experience that she felt she couldn't get on a sterile space station.
Zoe soon fits in well in the TARDIS, although Jamie is at first put off by her ascertive behavior, he eventually ends up developing a friendly bantering relationship with her. He of course also has to feel very protective of her, despite her belief she can take care of herself.
Although she is presumably still quite young, she has a genius level intelligence that could rival the Doctors. In fact the Doctor frequently has her do complex computations when necessary. She holds a degree in pure mathematics, and coupled with her photographic memory and the advanced learning techniques of her era, this makes her somewhat like a human calculator, able to perform complicated mathematics in her head.
Zoe's travels with the Doctor come to an end on the battlefields of The War Games, when the Time Lords finally put the Doctor on trial for interfering with the universe. For his offenses the Doctor is forced to regenerate and exiled to Earth. Except for their first meeting with the Doctor, Jamie and Zoe's memories of their travels with the Doctor are erased, and they are returned to their own points in time.