Ron and Harry were stopped before they could cross the barrier to the school.

"We're gonna get reprimanded!" Ron panicked.

Then Harry rubbed his chin and hummed. "Let's just wait. Surely, your mum or dad will notice we're not there."

And they did. So then they took Harry and Ron back to the Burrow and from there they apparated to the edge of Hogwarts' campus.

Harry nearly puked at the sensation. Ron laughed, having apparated with his family many times before.