In other words, how can he be merciful enough to FORGIVE all sins, but then be just enough to PUNISH all sin, as well? This is why his incarnation into our life was so important. Infinite mercy and punishment CAN co-exist if God suffers that punishment in our place, which he did as Jesus Christ on the cross. Thus, he can be infinitely merciful to those that accept that sacrifice and let it represent them, and infinitely judgmental against those that reject it. In other religions, such as Islam, this question DOES create a conflict, since gods like Allah do NOT suffer our punishment.
To declare, I say, at this time his righteousness: that he might be just, AND the justifier of him which believeth in Jesus.
Behold therefore the goodness AND severity of God...
If you're wondering why God couldn't just let the sin slide, or why God would ever create a condition that would require him to suffer in our place, you need to understand what a covenant is, and what one means to God:
When you're omnipotent, as God is, everything, starting from the second most powerful entity on down, is infinitely unneeded by you. That may sound harsh, but consider the truth of it: All limited quantities, no matter how great, are infinitely small by comparison to something that's infinite, effectively putting everything beneath you in the same boat. Thus, choosing something to be important to you is purely arbitrary, unless you create a condition upon which one of your creations can be exalted to some sort of status. This is what a covenant is. It is an agreement that details the reasons two parties are important to each other. The important thing to remember is that God never revokes a covenant, once made, and that includes the penalty of breaking it. He doesn't do that so he can be harsh; he does that so he can be generous when someone KEEPS his covenants. Covenants are the way God exalts people to himself, and he takes them seriously. This is why it says in (Ecclesiastes 5: 2) to let your words before God be few, and in (Deuteronomy 23: 21-23, and Numbers 30: 2) to never make a vow with God you aren't sure you can keep. Look what happened to a guy named Jephthah in (Judges 11: 30-40) when he made a particularly foolish vow to God.
God used a covenant to exalt man, and it exalted man so much, in fact, that it elevated man above the angels (Hebrews 1: 4-5). When man earned the death penalty of breaking this covenant (because any amount of being out of God's will brings about death), God had to be incarnated as one of us and suffer the death penalty in our place, effectively giving us a second chance. Unbelievably (pun intended), there are some people out there not only missing that second chance, but taking people with them by the millions.
To understand the covenant Jesus made with God on our behalf better, please read the article, 'Why did Jesus have to die?'