The astounding success of the first-ever animated feature, Walt Disney's Snow White and the Seven Dwarfs (1937), was not lost on MGM, which wanted a fantasy film of its own to capture some of Snow White's thunder. In January 1938, MGM purchased the rights to Frank L. Baum's novel from producer Samuel Goldwyn.
The initial script went through many changes. The movie's original producers thought that audiences would not accept the story of Dorothy's journey to Oz as a straight-on fantasy, so they presented it as an elaborate dream. Also, the movie was intended to have an epilogue where Hunk (the Kansas counterpart to Oz's Scarecrow) wishes Dorothy farewell as he goes off to agricultural school, just as the final movie featured a tearful farewell between Dorothy and the Scarecrow.
Ironically, for a musical, the movie's intended music suffered the most from excisions. Dorothy was to have participated in an Oz singing contest where her "hep" vocal style won over the residents of Oz. Another number, "The Jitterbug," was filmed but then removed from the movie; the audio recording can be found on special Oz soundtracks. The most dramatic deletion would have been Dorothy's first, plaintive song, "Over the Rainbow," which was nearly removed when MGM decided the movie was too long and was looking for scenes to cut. The number was removed but later restored before release.
Casting was a major issue for the movie. Two instances of "stunt casting" occurred with the roles of Dorothy and the Wizard. Producer Mervyn Leroy was initially pressured to borrow Shirley Temple from 20th Century-Fox to play Dorothy, But after Temple auditioned for Leroy, he decided he needed a singer with a different style. W.C. Fields was first choice as the Wizard until he asked for too much money; Frank Morgan took the role.
Physical injury also thwarted some of the casting. Ray Bolger was to have played the Tin Man, and Buddy Ebsen (later to gain fame on TV's Beverly Hillbillies) was to play the Scarecrow. But Bolger, unhappy with his role, convinced Leroy to switch his and Ebsen's roles. Unfortunately, Ebsen was unknowingly inhaling much of the aluminum powder make-up that he wore for his new role. Nine days after filming began, Ebsen was removed from the movie when the powder coating his lungs sent him to the hospital in critical condition. (However, Ebsen ended up outliving all of Oz's major actors, dying at age 95 in 2003.)
Gale Sondergaard was to have played the Wicked Witch but objected to her part being turned into an "old hag"; she was replaced by Margaret Hamilton. She, too, suffered injury when she was burned in her final scene where the Witch is melted by water.
Before the movie was finished, it would have four directors. Richard Thorpe began the filming but was fired and briefly replaced by George Cukor, who was in turn replaced by the only credited director, Victor Fleming. When Fleming had to leave the movie early owing to his commitment to Gone with the Wind, King Vidor finished the last scenes to be filmed (mostly Judy Garland's "Over the Rainbow" number).
The Wizard of Oz was enormously popular upon first release but still lost money, owing to most of its viewers being young children who paid lower admission prices. The movie didn't get into the black until its 1949 re-release. The movie's fortunes and reputation were cemented when it was sold in 1956 for broadcast on TV, where is has been a well-loved perennial ever since.