In the filmed version, the USS Enterprise crew discover a time portal on a planet. Leonard McCoy goes through this portal, and the crew find themselves cut off from the starship. Mr. Spock's tricorder suggests that the starship no longer exists, and they deduce that McCoy has interfered with the past somehow. They go through the portal themselves, and discover McCoy in 1930s America.
They conclude that the specific interference would be McCoy saving the life of Edith Keeler (played by Joan Collins) - as this would apparently then led to her continuing anti-war activism, leading to a delayed United States entry into World War II and hence a Nazi Germany victory. Kirk, having fallen in love with her in the meantime, prevents McCoy from doing so, and they return home.
The portal is revisited in the animated series episode Yesteryear, and numerous books.