Deuteronomy 19 records two situations in which God told His people to take no pity. In the case of someone who purposely, intentionally killed someone. They were to take no pity on such a person but hand him over to the avenger of blood to kill him ( verses 11-13). Also if someone witnessed falsely against another person, they were to take no pity on that person but do to him whatever he thought should be done to the person he witnessed against ( verses 15-21). So in the context of sin, wrong doing they were to take no pity.
This position contrasts God’s character that we read about recently in Psalm 103 verse 13:
13 As a father pities his children,
So the Lord pities those who fear Him.
God does take pity on those who fear Him, but told His people to take no pity on intentional sin.
This tells us something about the nature of sin, how destructive it is. Because God takes pity on us, He tells us to take no pity on sin. He knows the damage it does to us, and so He calls us to zero tolerance of sin.
In Romans 12:9 we are told to hate what is evil. Sin is evil so this amounts to being told to hate sin have no pity on it, as God told His people to do in Deuteronomy 19. Hate is a strong word, but we are to hate sin and evil as God does, because they are so harmful. God’s hatred of sin is an expression of His good character. Because He is good He hates sin, because it is so damaging. Everything about it is so opposite to Himself, what He wants for us and where He wants us to go.
When we see sin for what it is, we can see why God told His people to take no pity on it and why we are told to hate it.