It seems harsh to our ears. A man gathers wood on the Sabbath, and the Lord says he must be put to death by stoning.
If would seem harsh except that the Lord had made it clear and Moses had announced to all the people—the one who works on the Sabbath will be put to death. The man worked. And now he had to face the penalty of the crime.
It isn’t that he worked on the Sabbath so much as he rebelled against God. He treated with contempt the laws of God.
If the Lord made a law and didn’t follow through with the consequences, there would be no respect for Him. He made the consequences clear. And the man chose to violate that law. The man knew what was at stake.
We face the same. The Lord has said we will die in our sins if we do not repent. He also says that if we continue to sin after we receive the knowledge of the truth, we will die in our sins. So is God unjust to give us what we deserve when we know plainly what he has said?