In October 1899, six months after returning home from the Land of Oz, Dorothy Gale is melancholic. Her Aunt Em and Uncle Henry take her to Dr. Worley, known for his electrotherapy treatments, and leave her under the care of Nurse Wilson. During a thunderstorm, the lab suffers a blackout and Dorothy is saved by a mysterious girl. They escape with Nurse Wilson in pursuit, and fall into a river. Dorothy clambers aboard a chicken coop, but the other girl appears to have vanished underwater.
Upon awakening, Dorothy finds herself back in Oz with her chicken Billina, who can now talk. They find the Emerald City in ruins and its citizens (including the Tin Woodman and Cowardly Lion) turned to stone. Pursued by Wheelers (humans who have wheels instead of hands and feet), Dorothy and Billina hide in a room accessed by a glyph key Billina earlier had found. They meet a mechanical man, Tik-Tok, who explains that King Scarecrow has been captured by the Nome King, who is responsible for the Emerald City's destruction. The three visit princess Mombi in hopes of getting more information, but she is working with the Nome King and imprisons them.
Dorothy, Billina, and Tik-Tok meet Jack Pumpkinhead, who explains he was brought to life via Mombi's Powder of Life. Dorothy uses the Powder of Life to vivify the Gump, the head of a moose-like animal whose body they put together using two sofas, palm leaves, a broom, and rope. Using the Gump as transport, the group escapes and flies across the Deadly Desert to reach the Nome King's mountain. In his underground domain, the Nome King tells Dorothy that the Scarecrow stole the emeralds from him to build the Emerald City, and should be punished. He does not listen when Dorothy protests that the emeralds preceded the Scarecrow at the city. The Scarecrow has been turned into an ornament, and the group has three guesses each to identify which one he is, or they will be turned into ornaments themselves. The Gump, Jack and Tik-Tok each fail and are turned into ornaments. The Nome King gives Dorothy the chance to go home unscathed since he has her discarded ruby slippers, but Dorothy refuses to use them to leave her companions.
On Dorothy's last guess, she locates the Scarecrow, having deduced that people from Oz turn into green ornaments. The hunt for green ornaments yields Jack and Gump, but the enraged Nome King, who has trapped Mombi in a cage, confronts Dorothy and company and transforms in a monstrous form where he eats the Gump's couch body. He tries to eat Jack, but Billina, hiding in Jack's head, lays an egg in fright and it falls into the Nome King's mouth. Due to eggs being toxic to Nomes, the Nome King and his subterranean kingdom crumble to pieces all around Dorothy and her friends. Dorothy finds the ruby slippers and wishes she and her friends be returned to a restored Emerald City. There, they mourn the loss of Tik-Tok until Billina notices a green medal stuck to one of the Gump's antlers; Dorothy uses one more "guess" and Tik-Tok materializes.
At a celebration, Dorothy is asked to be Queen of Oz but refuses, realizing she must return to Kansas eventually. She learns that the girl who helped her escape the hospital is Princess Ozma, Jack's long-lost creator, and the rightful ruler of Oz, who had been enchanted by Mombi at the Nome King's request. Ozma forgives the no-longer-magical Mombi. She takes her place on the throne and Dorothy hands over the ruby slippers. Billina opts to stay in Oz. Ozma sends Dorothy home, promising that Dorothy is welcome to return.
Back in Kansas, Dorothy's family finds her on a riverbank. Aunt Em reveals that Worley's hospital was struck by lightning and burned down, and Worley died trying to save his machines. They see Nurse Wilson, arrested and locked in a cage on a horse buggy. Upon returning to the farmhouse, Dorothy sees Billina and Ozma peering at her through her bedroom mirror. When Dorothy entreats Aunt Em to come to her room to see Ozma, Ozma silently instructs her to keep her and Oz a secret.
Whose hospital was struck by lightning and burned down?
Worley