Early drafts for Harlan Ellison's teleplay "City on the Edge of Forever" included a guest character, Beckwith, an Enterprise crew member who dealt in addictive "Jewels of Sound." It was Beckwith who escaped into the past, via the Guardian of Forever. Gene Roddenberry asked him to change this element, on the grounds that no member of *his* crew would ever use or deal in illegal drugs. According to Ellison's account in the book "Harlan Ellison's the City on the Edge of Forever: The Original Teleplay That Became the Classic Star Trek Episode", for years after the series was canceled, Roddenberry said that Ellison's original draft had been unusable because "he had Scotty dealing in interplanetary drugs" - although Mr. Scott does not even appear in that draft.
When William Shatner and Joan Collins are walking together on the street, they pass in front of a shop with the name Floyd's Barber Shop clearly painted on the window. This is the same Floyd's Barber Shop that is often seen on The Andy Griffith Show (1960), adjacent to the sheriff's office, in the town of Mayberry.
In Harlan Ellison's original story Beckwith's change of the past is revealed by members of the Enterprise team who are beamed back to the ship, only to find it is now a pirate vessel named The Condor. This idea was later used in Star Trek: Mirror, Mirror (1967).
One of only two times in the original series that a "curse word" is heard, when Kirk says, "Let's get the hell out of here" at the very end. The second is in Star Trek: The Doomsday Machine (1967), when Kirk sees the Enterprise being drawn into combat with the Machine he says "[What] the hell's going on?".
When Kirk gazes upwards, the star pattern changes. This was mistaken as an error before the fade-out of Act One. The starscape effect was to visualize for audiences that no starships (at least from Starfleet) exist in the present.
Harlan Ellison's original script was extensively rewritten by D.C. Fontana at Gene Roddenberry's behest. Ellison was very unhappy about this, even though the episode won numerous awards (including Hugo Award for Best Dramatic Presentation) and is regarded as one of the classics.
After Kirk and Spock talk about the "flop", the scene changes to a street view, where a Kosher Meat store, with a big star of David, is conspicuously displayed in the center of the scene, this is one of the very few times a human (Earth) religious symbol is displayed in this series.
Harlan Ellison's original story also described the architecture of the city of the time portal as "covered with strange runes". Somehow this was interpreted as intending for the city to be depicted as being covered by the remnants of architectural ruins when visualized for the filming on set.
The title of this episode refers to both the dead city on the time planet and New York itself, where the timeline will either be restored or disrupted. In Harlan Ellison's original script, Kirk, upon first seeing the city sparkling like a jewel on a high mountaintop, reverently says it looks like "a city on the edge of forever". In Ellison's first treatment for this episode, the city they travelled back in time to was Chicago.
When asked in February 26, 1992 interview whether the makers of this episode consciously intended it to have the contemporaneous anti-Vietnam-war movement as subtext, associate producer Robert H. Justman replied, "Of course we did."
In Harlan Ellison's very first story outline, Beckwith was sentenced to death after he murdered LeBeque, and Kirk ordered his execution to take place on the next deserted planet the Enterprise comes across. Hence, they beam down with Beckwith and a firing squad to the Guardian Planet. This was very soon eliminated from the story.
Harlan Ellison also wrote scenes in which the regular characters acted very much unlike their usual behavior. For example, Kirk and Spock got into a heavy argument when Spock, witnessing a street speaker calling out against foreign immigrants, called the human race barbaric. Kirk then claims he should've just left Spock to be lynched by the mob.
This was the most expensive episode produced during the first season, with a budget of $245,316, and also the most expensive episode of the entire series, except the two pilots. The average cost of a first season episode was around $190,000. Also, production went one and half days over schedule, resulting in eight shooting days instead of the usual six.
Clark Gable, who was by no means a leading man in 1930, was not the original choice of reference. The final shooting draft of this script has Edith reference "a Richard Dix movie", but the crew on the set felt Dix's name wouldn't be familiar to viewers in the 1960s.
Originally then-story editor Steven W. Carabatsos got the job to rewrite Harlan Ellison's script, but his draft was not used. Instead, Ellison agreed to make a rewrite himself, which was again deemed unsuitable. Producer Gene L. Coon also got himself into the rewriting. Finally, the new story editor, D.C. Fontana got the assignment to rewrite Ellison's script and make it suitable for the series. Fontana's draft was then slightly rewritten by Roddenberry to become the final shooting draft. Much of the finished episode is the product of Fontana, who went uncredited (as did all the other writers) for her contribution. Only two lines from Ellison's original teleplay survive in the final episode, both spoken by the Guardian: "Since before your sun burned hot in space, since before your race was born," and "Time has resumed its shape."
The trivia items below may give away important plot points.
In Harlan Ellison's original story, Kirk and Spock are aided in the 1930's by a vagrant called Rodent who reveals himself to be a veteran of the Battle of the Somme. In the final product, Rodent is the bum who incinerates himself with McCoy's phaser.
Rodent's death is deleted in some rebroadcasts, but is intact in home video editions. When McCoy meets Rodent holding the milk bottle, the scene ends with McCoy collapsing, then cuts to McCoy meeting Keeler in the Mission. In the complete scene, after McCoy collapses, Rodent picks McCoy's pocket and takes his hand phaser (which he took from the transporter chief) and accidentally sets it on overload, killing himself.