This is book number 3 in the The Chronicles of Prydain series.
The Castle of Llyr by Lloyd Alexander, Book Three in The Chronicles of Prydain
Princess Eilonwy hates to leave her friend Taran, Assistant Pig-Keeper, and her beloved home, Caer Dallben. Why does she have to go to the Isle of Mona to train as a proper lady when she's already a princess? But Eilonwy soon faces much more than the ordeal of becoming a dignified young maiden, for she possesses magical powers sought by the evil enchantress Queen Achren.
When Eilonwy is put under a deep spell, Taran and his companions set out on a dangerous quest to rescue her. Yet how can a lowly Assistant Pig-Keeper hope to stand against the most evil enchantress in all of Prydain?
“An exciting, highly imaginative, and sometimes profound fantasy of humor and heroism.” —The New York Times
“Character and dialogue is handled humorously and dextrously, which sets this classic-in-the-making apart from other folklore-based fantasies.” —Kirkus Reviews (Starred Review)