The original Star Trek show went from 1966 to 1969. The show was actually not a success at the time, and NBC cancelled it in 1969 due to low ratings. After playing Captain Kirk for those 3 years, things got really bad for William Shatner.
Right before the show was cancelled, his wife asked him for a divorce. He had difficulty landing other big acting opportunities. Due to his limited acting opportunities and lack of money, he was forced to live in a truck bed camper in the San Fernando Valley. He calls this "that period" in his life, where he felt humbled and had to take any and all jobs to support his family.
His fortunes would soon reverse, though. Star Trek proved to be a huge success in syndication. The show's counter-culture messaging had a huge appeal during the 70s (for example, Star Trek is often credited as having the first interracial kiss on television) and the show became a huge hit. Captain Kirk became a cultural icon, and there were talks of a new TV show. Instead of another TV show, Paramount produced a full-length motion picture, and the rest is history. Shatner's career was jump-started and is going strong to this day.