" ...the castle's protected by more than walls, you know ... There are all sorts of enchantments on it, to stop people entering by stealth. You can't just Apparate in here"
-- Hermione (PA9)
Anti-Apparition Charms prevent someone from Apparating, or magically traveling to a location.
References from the canon
- It is impossible to Apparate or Disapparate inside Hogwarts School of Witchcraft and Wizardry (PA9, PA22, GF15, HBP18, Pm). However, the Headmaster can lift the restriction, as when the students who have come of age are getting Apparition lessons (HBP18).
- House Elves are able to Apparate and Disapparate inside Hogwarts due to their own special abilities, as well as making their jobs easier as they clean and move food from the kitchen to the Great Hall (JKR).
From the Web
"The Hogwarts Express" by J.K. Rowling on Pottermore
"Anti-Apparition Charm" from Harry Potter Wiki