"The pupils had gone to school."
Translation:Elevene hadde gått til skolen.
If I substitute elevene (the pupils) with something more general it's easier to construct some examples.
Damene hadde gått til skolen - The ladies had gone to (get to the) school. They might not be pupils, but they are going over to the school attend something there. And 2: The ladies had walked to school. As opposed to taking the bus or drive...
Damene hadde gått på skolen - The ladies had attended school. They used to be pupils.