Translation:The teacher does not hit the undutiful boys.
Impious is one of the meanings, but in this context, "undutiful, unrespectful" is more logical. Unless it's a madrassa-like school, it's more logical to hit a unrespecful student, than a boy who doesn't want to go to church.
So, it's the more natural meaning in this context.
But if we imagine a religious school, the other translation is possible.