Question: "Why is every sin ultimately a sin against God?"
Answer: Sin often harms another person, but, ultimately, all sin is against God. The Bible contains many references to people admitting, "I have sinned against God" (Exodus 10:16; Joshua 7:20; Judges 10:10). Genesis 39:9 gives us a closer look at this. Joseph was being tempted to commit adultery with Potiphar's wife. In resisting her, he said, "My master has withheld nothing from me except you, because you are his wife. How then could I do such a wicked thing and sin against God?" It is interesting that Joseph did not say that his sin would be against Potiphar. This isn’t to say that Potiphar would be unaffected. But Joseph's greater loyalty was to God and His laws. It was God he did not want to offend.
David said something similar after he had sinned with Bathsheba (2 Samuel 11). When confronted with his sin, David repented in great sorrow, saying to God, "Against You and You only have I sinned" (Psalm 51:4). He had clearly sinned against Bathsheba and her husband, too, but it was the violation of God's law that grieved David the most. God hates sin because it is the antithesis of His nature and because it harms us or someone else. By sinning against God, David had also hurt other people.
When someone commits a crime, the person who was harmed by the crime is not the one who punishes the criminal. Only the state can legally mete out punishment. It is the law that judges a person guilty or innocent, not the victim. It is the law that was violated. Regardless of the worthiness or innocence of the victim, all crimes are ultimately committed against the established law. If you rob your neighbor's house, you have obviously wronged your neighbor, but it is not he who holds you accountable. It is the higher law you have violated. The state bears the responsibility to convict and punish you; your neighbor, although affected by your crime, defers to the state.
In the same way, all moral law begins with God. Because we were created in the image of God, we have His moral law written within our hearts (Genesis 1:27). When Adam and Eve ate from the forbidden tree in the Garden of Eden, God said, “The man has now become like one of us, knowing good and evil” (Genesis 3:22). At that time, no written law had been given, as far as we know. Yet God had clearly communicated His will to Adam and Eve, and they knew that they had sinned and ran to hide from God (Genesis 3:10). Their shame after sinning was intuitive.
We also know intuitively when we have sinned. Sin is a perversion of God's perfect design. We all bear the very image of God Himself, and when we sin, we mar that likeness. We were created to be mirrors of the glory of God (Ephesians 2:10; 4:24; Hebrews 2:7). Sin is a big smudge on the mirror, and it diminishes the beauty and holiness we were designed to reflect. When we sin, we step outside the purpose for which we were created, thus violating God's moral law, and we are accountable to Him for the trespass. Romans 3:23 says, "All have sinned and come short of the glory of God." Sin is anything that falls short of God's plan. So, whether it harms us or someone else, every sin is ultimately against a holy God.