Penned by Joseph Mallozzi and Paul Mullie, "Window of Opportunity" was the writing duo's second script, and their first episode to air. Mallozzi and Mullie would later become executive producers of both Stargate SG-1 and Stargate Atlantis. The episode's unique story style caused an unexpected shortage of footage during filming, which director Peter DeLuise tried to compensate by shooting additional unscripted scenes, many of which were humorous. "Window of Opportunity" is widely regarded as a fan favorite.
On a mission on P4X-639, a planet experiencing strong solar activity, the SG-1 team encounters an alien archaeologist named Malikai (Robin Mossley). When a geomagnetic disturbance hits its peak, the Stargate activates simultaneously on the planet and on Earth, and a flash strikes Malikai, Colonel O'Neill (Richard Dean Anderson) and Teal'c (Christopher Judge) near an Ancient altar. Moments later, O'Neill finds himself in the Stargate Command (SGC) cafeteria in the middle of a conversation with Dr. Daniel Jackson (Michael Shanks) and Major Carter (Amanda Tapping), who claim to have no knowledge of the planet. O'Neill and Teal'c later express familiarity with the events, but they are certified perfect health. Before SG-1 can resume their planned mission to the planet, an unscheduled offworld activation of the Earth Stargate, accompanied by flashes, transports O'Neill back to breakfast.
While the events at the SGC repeat themselves, Daniel makes first progress in the decryption of photos of the planet's altar writings. SG-1 return to the planet where Malikai makes a slip, but O'Neill finds himself back at breakfast before the altar's activation can be stopped. With the help of O'Neill's and Teal'c's explanations, Carter devises a plan to break the time loop by preventing an incoming wormhole, which fails. Meanwhile, Daniel attempts to translate the altar's writing loop after loop until O'Neill and Teal'c realize the only solution is to learn and remember the alien language themselves. After many loops of teaching, Daniel makes an offhand remark about the looping causing no consequences, which inspires O'Neill to try pottery and to bicycle through the military base. At other times, O'Neill and Teal'c golf through the Stargate, Teal'c takes action against the painful starts of his loops, and O'Neill resigns his commission from the Air Force to kiss Carter.
After what is later believed to have been at least three months, Daniel is finally able to reconstruct the planet's history with the finished translations; the Ancients had attempted to escape an unidentified disaster by building a time machine but never got it to work properly. Upon returning to the planet, SG-1 learn of the death of Malikai's wife, whom Malikai wants to visit in the past with the help of the time machine. O'Neill's experience of his son's death convinces Malikai to shut down the device before a new loop can start. Back at the SGC, O'Neill, Carter, and Daniel have their first breakfast after the loops, and O'Neill answers Daniel's question about unusual activities in the loops with a long look at Carter.
"Window of Opportunity" was the second Stargate SG-1 script by Joseph Mallozzi and Paul Mullie, and their first episode to air. The writing duo's first script, , would air three episodes later. Choosing "Ad Infinitum" as the episode's working title, Mallozzi and Mullie originally pitched "Window of Opportunity" as a darker story from the finished episode. SG-1 would encounter a world whose scientists work feverishly on preventing an imminent apocalypse, but after being unable to find a solution in time, they initiate a time loop that would trap the SG-1 team. Executive producer Brad Wright however noted the similarities to the Star Trek: The Next Generation episode "Cause and Effect", and writer Robert C. Cooper suggested a lighter direction similar to the feature film Groundhog Day, which O'Neill would briefly reference in the episode. To simplify continuity in the shooting process, Brad Wright encouraged chaos-theory-type fluctuations in the story as early as in the episode's concept meeting. Director Peter DeLuise asked the prop department to glue Froot Loops to O'Neill's breakfast spoon to have the same loops in the same spots in each take.
The off-world scenes were filmed on an interior sound stage, using occasional lens flares and off-camera fans to simulate weather. A matte painting by the in-house visual effects department later served as a sky replacement for the used greenscreen. The Vancouver-based company GDFX was responsible for almost all visual effects shots, some of which were re-used within the episode to save money. Other visual effects clips were re-used from previous episodes. "Window of Opportunity" was the first episode to feature a rear-screen projection in the briefing room. To speed up the shooting process, scenes were filmed in thematic blocks instead of in a story-chronological order, and short sequences were re-used to help the audience with a visual recall in new scenes. Sound effects were later added to give the wooden altar prop the impression of being made of stone.
It became evident by the third day of production that the episode was going to run significantly short, partly caused by the time-efficient filming style. The scene in which Daniel informs Jack and Teal'c of the opportunity to do whatever they like, was a late pitch by Brad Wright, who had also had the idea for some time to show someone golfing through the Stargate. Preliminary discussions about computer-generating the golf ball to not break the US$ 100,000 Stargate prop were later overturned, and the actors used a real golf ball. Many of the other humorous scenes in "Window of Opportunity" were improvised on set during filming. With juggling being one of Richard Dean Anderson's earlier careers, director Peter DeLuise filmed the juggling sequence in a last effort to fill the episode's time slot. "Window of Opportunity" has no deleted scenes.
As the first episodes of Season 4 addressed the attraction between O'Neill and Carter, its aftereffects were chosen to be still noticeable in "Window of Opportunity". The progressing frustration of Teal'c, "the man of infinite patience", is shown by his Kel'no'reem'ing (a fictional medital state) during the briefing. The episode's main guest star was Robin Mossley as Malikai; Mossley would play a different character in the Season 10 episode . Several crew members make cameo appearances in "Window of Opportunity". Nicole Forrest, the show's head of accounting and director Peter Woeste's wife, appears as Malikai's wife on a photographic device. One of Anderson's stand-ins on SG-1, Bill Nikolai, plays the technician in O'Neill's bicycle scene. Director Peter DeLuise briefly appears as an airman who helps Daniel recover from being repeatedly knocked down by Sgt. Siler in each loop. Siler himself is played by stunt coordinator Dan Shea. The name of writer Joseph Mallozzi appears as the author of the book that O'Neill and Teal'c use to study the Ancient language.
In his book Approaching the Possible, Jo Storm saw the episode's title hinting at an "inevitable" story line about the sexual tension between O'Neill and Carter that has been looming since the beginning of the series. The characters "break[ing] the rules of conduct for their jobs" (fraternization) made the episode "seem completely unnatural", while it allowed the writers to explore possibilities in the narrative. Jo Storm also credited the writers for breaking the "boring" convention of getting either only one or all teammembers caught in a time loop. The producers enjoyed having O'Neill and Teal'c instead of the usual intellectual combination of Carter and Daniel solve the puzzle. Peter DeLuise regarded the episode as "funnier" and "more lightheartened" than usual episodes.
A Season 4 DVD review by digitallyobsessed.com gave "Window of Opportunity" 4 out of 5 points, calling it an "enjoyable", "charming", and "unique" episode and "one of the series' most entertaining stories". Other reviewers found the episode "hilarious and "a fine example of SG-1 at its humorous best". The 2000 XPosé Yearbook ranked "Window of Opportunity" as the second-best episode of science fiction television in the year 2000. A sampling of fan opinions on space.com in 2001 showed the episode as a "clear favorite". In a fan poll conducted in 2007 on the Sci-Fi Channel's website, "Window of Opportunity" was voted the "best episode ever" out of thirty-two preselected Stargate SG-1 episodes, and the majority of participants in a 2007 SG-1 fan poll on MSN Canada named the episode their "favourite of all time.