1. was punished, was brought to justice
he finally got his due when he was caught/punished/beaten up
To be 'due' something is to be owed it. If you say someone 'got their due' it means that they got what was owed to them or what was coming to them. Usually, this phrase is used in situations where people experience negative results of actions they have taken in the past. Similar in meaning to 'get what was coming to you' or 'karma'. "After years of exploiting staff, the business owner got what was coming to them when an employment bureau investigated the firm, charging him with dozens of offences." This is an idiomatic expression used in both social and professional contexts.
2. was recognized for, was rewarded for
he finally got his due with promotion/reward/award/prize
To be 'due' something is to be owed it. If you say someone 'got their due' it means that they got what was owed to them or what was coming to them. In a positive respect, this can mean that someone has earned a reward or has benefitted from their hard work or actions in the past. "She finally got her due for all the long nights studying when she received a scholarship to a prestigious University." You will hear this expression used both in social and professional contexts.