While Dorothy Gale is at home in Kansas one day, she and her pet dog Toto, meet the Shaggy Man who comes walking past the Gale farm. He is a friendly, yet slightly senile hobo with an optimistic, care free mentality. He politely asks Dorothy for directions to Butterfield, which is the nearest town on the prairie. The girl agrees to show him the way, bringing her dog with her. Further on, the road splits into seven paths. They take the seventh one and soon find themselves lost in what appears to be another dimension. The trio meets Button-Bright, a cute and wealthy little boy in a sailor's outfit who is always getting lost. Later, the companions encounter Polychrome, the beautiful and ethereal Daughter of the Rainbow who is stranded on earth. Polychrome explains that she accidentally fell off her father's bow while dancing on it. The bow ascended into the atmosphere and back into the clouds before she was able to climb her way back on it, thus being left behind.
Dorothy, Toto, the Shaggy Man, Button-Bright, and Polychrome eventually come to the peculiar town of Foxville, where anthropomorphic foxes live. With prompting from King Dox of Foxville, Dorothy deduces that she and Toto are obviously on another "fairy adventure" that will ultimately lead them to magical Land of Oz, just in time for Princess Ozma's royal birthday party, (which is now acknowledged as August 21 by Oz fans, even though the book only refers to the 21st of the month). Dorothy having mentioned that the current month is August in another passage. The king takes a particular liking to Button Bright, whom he considers astute and clever due to his tabula rasa-like mind. Believing that the human face does not suit one so clever, Dox gives him a fox's head. A similar event subsequently happens to the Shaggy Man, when King Kik-a-Bray of Dunkiton confers a donkey's head upon himâalso in reward for cleverness, even though it's implied that Foxville and Dunkiton exist at odds with one another.
After meeting the Musicker, who produces music from his breath, and fighting off the Scoodlers, who fight by removing their own heads and throwing them at the travellers, Dorothy and her companions reach the edge of the fatal Deadly Desert completely surrounding Oz. There, the Shaggy Man's friend Johnny Dooit builds a "sand-boat" by which they may cross. This is necessary, because physical contact with the desert's sands, as of this book and Ozma of Oz (1907), will turn the travelers to dust.
Upon reaching Oz, Dorothy and her companions are warmly welcomed by the mechanical man Tik-Tok and Billina the Yellow Hen. They proceed in company, to come in their travels to the Truth Pond, where Button Bright and the Shaggy Man regain their true heads by bathing in its waters. They meet the Tin Woodman, the Scarecrow, and Jack Pumpkinhead who journey with them to the imperial capital called Emerald City for Ozma's grand birthday bash. Dorothy meets up with Ozma as her chariot is pulled in by the Cowardly Lion and the Hungry Tiger.
As preparations for Ozma's birthday party are made, the guests include Dorothy, Scarecrow, Tin Woodman, Cowardly Lion, the Wizard of Oz, Jack Pumpkinhead, Sawhorse, Tik-Tok, Billina, Jellia Jamb, Woggle-Bug, Hungry Tiger, the Good Witch of the North, Shaggy Man, Button-Bright, Polychrome, and characters from all over Nonestica (such as Santa Claus, a band of Ryls, and a bunch of Knooks from the Forest of Burzee, Queen Zixi of Ix, the Queen of Merryland, four wooden soldiers, and the Candy Man from Merryland, the Braided Man from Boboland's Pyramid Mountain, the Royal Family of the Land of Ev, King Bud and Princess Fluff from Noland, and John Dough, Chick the Cherub, Para Bruin the Rubber Bear from Hiland and Loland) as well as invitations to King Dox, King Kik-a-Bray, and Johnny Dooit. The Shaggy Man receives permission to stay in Oz permanently. He is given, in addition to this, a new suit of clothes having bobtails in place of his former costume's ragged edges, so that he may retain his name and identity.
After everyone has presented their gifts and feasted at a lavish banquet in Ozma's honor, the Wizard of Oz demonstrates a method of using bubbles as transportation by which to send everyone home. Polychrome is finally found by her rainbow family and she is magically lifted into the sky when she climbs back onto her bow. Button-Bright goes home with Santa Claus to the North Pole in a soap bubble. Dorothy and Toto are finally wished back home to Kansas again by Ozma's use of the Magic Belt.

Question: Where were Dorothy and Toto on their way to?
Answer: The magical Land of OZ.