From Wikipedia: About five minutes into the film, Dorothy sings the song after failing to get Aunt Em, Uncle Henry, and the farmhands to listen to her story of an unpleasant incident involving her dog, Toto, and the town spinster, Miss Gulch (Margaret Hamilton). Aunt Em tells her to "find yourself a place where you won't get into any trouble". This prompts her to walk off by herself, musing to Toto, "Some place where there isn't any trouble. Do you suppose there is such a place, Toto? There must be. It's not a place you can get to by a boat, or a train. It's far, far away.