Only Kage, ANBU and Sannin are allowed to leave the village freely. Everyone else must get permission from the Kage before leaving. If you do not, you'll face the punishment.