Stardate 3134.0: The Enterprise is in orbit around a planet and riding out a series of temporal shock waves from the surface. A n explosion at helm injures Sulu and McCoy is called to the bridge. He risks a few drops of cordrazine and Sulu revives. One more ripple hits the ship and McCoy accidentally injects himself with the cordrazine and begins ranting hysterically about assassins. He throws off the crew and escapes on the turbolift.
McCoy goes to the transporter room, knocks out a technician, and beams down to the surface at the heart of the temporal disturbances. Kirk and Spock beam down with a landing beam and find a strange torus-shaped object filled with energy. When Kirk asks a question of Spock, the torus "responds" and identifies itself as the Guardian of Forever. As the rest of the team look for McCoy, Kirk and Spock talk with the Guardian, which displays them the history of Earth. McCoy comes charging out but the group secures him and Spock administers a nerve pinch to take him down. Kirk suggests they go back in time to prevent the injection, but the Guardian states that it can't slow down the rapid display of history through its core.
Spock starts recording the passage of years as McCoy wakes up and jumps through the portal. They try to communicate with the Enterprise but get no signal, and the Guardian tells them that not only has it disappeared but their entire history--somehow McCoy has changed history.
Kirk and Spock decide to go back through time to the same spot, although Spock can't precisely time it but thinks they'll arrive a month early so that they can stop McCoy. The Guardian assures them that if they're successful, they'll be returned. Kirk tells the others to try one at a time if they fail. Spock and Kirk arrive on 1930s Earth where they attract attention. They steal some clothing but run up against a policeman who doesn't buy Kirk's explanation of Spock having fallen into a mechanical rice-picker. Spock knocks him out and they flee through the streets and end up in the basement of a mission house. Spock suggests he must rig a device to access the tricorder readings of the Guardian to further pinpoint their location.
They're interrupted when a woman turns on the lights and comes down. As Spock covers his ears with a stocking cap, the woman, Edith Keeler, wants to know what they're doing. Kirk manages to charm her into giving them a job so Spock can afford the components to access the tricorder databanks.
Later, Kirk and Spock listen as Edith gives a speech that is eerily prophetic of the "future" that they've experienced. Kirk is impressed and then Edith compliments them on their work and gives them a place to stay in her apartment building. Later Kirk shows up to give Spock what few components he could buy with their limited financial and technological resources. They're interrupted when Edith shows up with more work and she notices Spock's contraption but Spock passes it off.
As they're working at the mission house, Spock notices one of the other men with some precision tools. Spock steals them and Edith later figures out they stole the tools and confronts them. She accepts Kirk's assurances that they would have returned the tools and she drops the matter, but wants Jim to walk her home. He takes her home while she probes for answers. In the apartment, Spock briefly brings up a news article of Edith's obituary before he loses the connection. Kirk arrives and Spock brings up another article, of Edith meeting with Franklin Roosevelt. The circuits burn out but Spock warns that the earlier article mentioned her death. He concludes that Edith is the focal point and they don't know if she must live or die to maintain their history.
McCoy appears in an alley and rants at a bum, who runs away. Kirk takes Edith up to her apartment while McCoy grabs the bum and wonders who is trying to deceive him. The next morning McCoy stumbles into the mission where Edith helps him, as Spock just misses seeing him.
Spock repairs the tricorder circuitry and determines that the U.S. delayed entering World War II and Germany won after developing the A-bomb first. The U.S. delayed entering the war because Edith started up a peace movement. Spock concludes that McCoy stopped Edith from dying in a street accident, altering history. However, he can't predict when the accident will happen. Kirk admits he's in love with Edith and Spock tells her she must die.
A recovered McCoy wakes up in Edith's back room and Edith doesn't believe his story. She leaves him to recover. Later she's coming down the stairs when Kirk catches her from what would be a nasty fall. Spock sees him do so and after she leaves, warns his captain that might have been the intended accident, but Jim notes McCoy hasn't arrived yet.
Edith drops in on McCoy who is looking better although he believe he's hallucinating. Edith mentions "her young friend" is taking her to a Clark Gable movie, but McCoy doesn't recognize the actor. Later Edith and Jim are gong to the movie and she mentions the Clark Gable movie and Jim doesn't recognize Gable's name either. She mentions McCoy's name and Kirk runs to the mission to get Spock, leaving Edith in the street. McCoy comes out and the three are reunited. Edith crosses the street to see what's going on and Jim grabs McCoy and stops him from saving Edith, and she is hit by the truck.
Back in their present, Spock and Kirk return through the Guardian only seconds after they left, followed by McCoy. The Guardian assures them history is restored and the Enterprise is back in orbit. Jim looks about in despair and then says, "Let's get the hell out of here."