Warning: Wikipedia contains spoilers.
Pingaree is an island in the Nonestic Ocean which surrounds the fairy countries which encircle the Deadly Desert that surrounds the land of Oz. Many years before this story begins, the armies of Regos and Coregos sought to invade Pingaree, but their advance was repelled by Pingaree's king with the help of three magic pearls given to him by the Mermaids. The Blue Pearl gave the king superhuman strength, the Pink Pearl protected him from any form of harm, and the White Pearl provided words of wisdom that only he could hear. Buoyed by the Pearl's magic powers, the king of Pingaree led his people to victory and the invaders from Regos and Coregos drowned on the return trip.
At the beginning of Rinkitink in Oz, King Kitticut and Queen Garee, the son and daughter-in-law of the victorious king. Their son Inga is coming of age to learn the secret of the pearls, and one day Kitticut reveals their secret hiding place to Inga. The next day, a royal visitor arrives at the island—King Rinkitink of Gilgad, a jovial and pleasantly plump fellow on royal holiday who remains on the island as Kitticut's guest for several weeks. Rinkitink's companion, other than the rowers from Gilgad, is a surly goat named Bilbil who seems to be Rinkitink's opposite in attitude.
Invaders from Regos and Coregos come again to Pingaree and seize the king before he can grab the pearls. All the buildings are torn down, and all the people are carried into slavery. The only ones remaining on the island are Inga, who was able to successfully hide in a collapsed building, Bilbil the goat, and Rinkitink, who escaped his pursuers by falling into a well. Inga realizes the only way he'll be able to free his family and people is with the help of the magic pearls, so he comes to the palace floor to retrieve them. To make sure the pearls don't get lost, he hides one each in the toes of his shoes and carries the speaking White Pearl with him. The White Pearl guides him to a boat the following morning which he, Bilbil, and Rinkitink begin to row toward the island of Regos.
Regos and Coregos are ruled by a wicked king and queen respectively, and they see no reason they can't capture Inga and his companions too. However, all of King Gos of Regos' forces can't lay a hand on Inga, Rinkitink, or Bilbil when they're touching each other due to the Pink Pearl's power. They stride into the royal palace with the strength conferred by the Blue Pearl and force Gos and his evil forces to flee the island to Coregos and then free the king's slaves.
Inga and Rinkitink wake the next morning and the Pink Pearl is gone—it was in the shoe that Rinkitink threw at a howling cat the previous night. At a loss, Inga tells Rinkitink and Inga about the power of the Pearls and attempts to bluff Gos and his wife, Queen Cor, into believing he's still got the power of the Pearls. Cor uses diplomacy and trickery to capture him and Rinkitink and bring them to serve her on Coregos.
Nikobob, a woodchopper on Regos, finds the discarded shoes (unaware that they contain the Blue and Pink Pearls) and plans to give them to his daughter Zella. While he has the shoes, however, he encounters the giant worm Choggenmugger and chops it into pieces—something he couldn't do without the pearls. Zella is wearing the shoes with the pearls inside when she delivers honey to Queen Cor on Coregos, Inga recognizes the shoes, and he exchanges them with Zella. Now with the Pearls in his possession, he defeats Cor and sends her fleeing to Regos with the captive Queen Garee. The captives from Pingaree and all the other places the invaders have been are now free except for Inga's parents.
To consolidate the situation of Regos and Coregos, Inga offers to make Nikobob king of the islands, which he adamantly refuses. He instead asks to go himself with his family to Pingaree. They learn from a palace guard that Gos and Cor took King Kitticut and Queen Garee to the underground caverns of the Nome King, and Inga, Rinkitink, and Bilbil set out after them.
Although Kaliko is a kinder Nome King than the previous one (who was kicked out in Tik-Tok of Oz), he considers himself bound by his word to King Gos and Queen Cor and has Kitticut and Garee kept prisoner. Before Inga, Rinkitink, and Bilbil enter the underground kingdom, Rinkitink asks Inga to loan him the Pink Pearl in case they get separated. They are welcomed cordially enough by the Nomes and spend the night underground, but the next day Rinkitink and Bilbil have an audience with King Kaliko who is unable to harm them together while Inga works his way through the Three Trick Caverns with his strength and the White Pearl's Wisdom.
Princess Ozma, the ruler of Oz, is viewing what's happening to Inga, Rinkitink, and Bilbil through her Magic Picture and Dorothy and the Wizard of Oz go to free them, King Kitticut, and Queen Garee and Dorothy herself carries a basket of eggs to keep the Nomes from attacking her. The reunited father, mother, and son with Bilbil and Rinkitink journey to the Emerald City, where it's revealed that Bilbil is actually enchanted himself.
Bilbil is actually Prince Bobo of Boboland, and the enchanter who transformed him into a goat is long since dead; however, Glinda is able to change him back to human form. This also cures his bad disposition, which was a cover for Bobo/Bilbil's ill feelings. After a celebration, Kitticut, Garee, Inga, Rinkitink, and Bobo return to the rebuilt island of Pingaree for a victory celebration marred only by Rinkitink's need to return to Gilgad.