To take to task is to chew someone out for something they’ve done wrong. If you don’t do your homework for a week, your teacher will take you to task, and you better straighten up!
A task is a job, and if someone takes you to task, they’re letting you know you did a bad job. A teacher yelling at students for talking is taking them to task. A boss scolding employees for being late is taking them to task. Parents take their children to task for not doing chores. If you take someone to task, you’re making sure that the object of your scolding is not getting away with their actions.