Sidney Poitier insisted that the movie be filmed in the north because an incident in which he and Harry Belafonte were almost killed by Ku Klux Klansman during a visit to Mississippi. Hence the selection of Sparta, Illinois for the location filming. Nevertheless, the filmmakers and actors did venture briefly into Tennessee for the outdoor scenes at the cotton plantation, because there was no similar cotton plantation in Illinois that could be used. Poitier slept with a gun under his pillow during production in Tennessee. Poitier did receive threats from local racist thugs so the shoot was cut short and production returned to Illinois.
This was the first major Hollywood film in color that was lit with proper consideration for an actor with dark skin. Haskell Wexler recognized that standard lighting used in filming produced too much glare on most black actors and others of dark complexion. Wexler toned down the lighting to feature Poitier with better results.
According to Sidney Poitier, Tibbs' retaliation slap to Endicott was not in the original script nor in the novel on which the film is based. Poitier insisted that Tibbs slap Endicott back and wanted a guarantee that the scene would appear in all prints of the film. According to Stirling Silliphant, the slap was in the original script though not in the novel.
Set in a hot Mississippi summer but filmed during autumn in Illinois, many of the actors had to keep ice chips in their mouths (and spit them out before takes) to prevent their breath from appearing on camera during the night scenes.
Rod Steiger was asked by director Norman Jewison to chew gum when playing the part. He resisted at first but then grew to love the idea,and eventually went through 263 packs of gum during the shooting of the film.
When Norman Jewison and his editor Hal Ashby attended a sneak preview for the film, they found that the young audience was laughing uproariously at the dialogue. Although Jewison was upset that his dramatic film was not being taken seriously, Ashby assured him that the audience was laughing in approval of the southern sheriff being put in his place by the confident and urbane Det. Virgil Tibbs. Jewison did not agree until the film got to the famous slapping scene; when the white audience was stunned at seeing an African American man physically fight back against a white man for the first time in a modern mainstream American film, Jewison was convinced the film was effective as drama.
Mississippi was eventually ruled out as a location due to the existing political conditions. Sparta, Illinois, was selected as the location, and the town's name in the story was changed to Sparta so that local signs would not need to be changed. The greenhouse was added to an existing home and filled with $15,000 worth of orchids.
Due to the assassination of civil rights activist Martin Luther King (April 4, 1968), the presentation of the Best Picture Oscar for this film was postponed for two days from Monday April 8th to Wednesday April 10, 1968. (see also - The Life of Emile Zola (1937) and Raging Bull (1980)).
The slapping scene between Det. Tibbs and Endicott was shot in just two takes, and the slaps the characters made to each other's faces were real, according to a detailed account Norman Jewison, provided in 2011. Jewison let Larry Gates rehearse by slapping him because Jewison wanted to be sure that Gates could slap hard enough.