God clearly defined the penalty for murder (Deuteronomy 19:11-13) and God set the penalty for rape (Deuteronomy 22:25), so the death penalty for these offenses cannot be wrong in God's eyes.
I think your confusing forgiveness with justice. While we can forgive, it doesn't absolve someone from reaping what they sow in the flesh. Its not vengeance, its justice, and it was ordained by God who is the same yesterday, today and forever. jmo
"But if a man find a betrothed damsel in the field, and the man force her, and lie with her: then the man only that lay with her shall die" (Deut 2:25)
"But if any man hate his neighbour, and lie in wait for him, and rise up against him, and smite him mortally that he die, and fleeth into one of these cities:Then the elders of his city shall send and fetch him thence, and deliver him into the hand of the avenger of blood, that he may die" (Deut 19: 11-12)
There is a difference between justice and forgiveness...
David learned this lesson all the way. In II Sam 11, David committed adultery with Bathsheba and then killed Uriah (a loyal and faithful man). He thought he had gotten away with it. Then we read chapter 12...
2Sa 12:7 And Nathan said to David, Thou art the man. Thus saith the LORD God of Israel, I anointed thee king over Israel, and I delivered thee out of the hand of Saul;
2Sa 12:8 And I gave thee thy master's house, and thy master's wives into thy bosom, and gave thee the house of Israel and of Judah; and if that had been too little, I would moreover have given unto thee such and such things.
2Sa 12:9 Wherefore hast thou despised the commandment of the LORD, to do evil in his sight? thou hast killed Uriah the Hittite with the sword, and hast taken his wife to be thy wife, and hast slain him with the sword of the children of Ammon.
2Sa 12:10
Now therefore the sword shall never depart from thine house; because thou hast despised me, and hast taken the wife of Uriah the Hittite to be thy wife.
2Sa 12:11
Thus saith the LORD, Behold, I will raise up evil against thee out of thine own house, and I will take thy wives before thine eyes, and give them unto thy neighbour, and he shall lie with thy wives in the sight of this sun.
2Sa 12:12
For thou didst it secretly: but I will do this thing before all Israel, and before the sun.
So God "lowered the boom" on David here. Was he doomed to eternal death?
2Sa 12:13 And David said unto Nathan,
I have sinned against the LORD. And Nathan said unto David,
The LORD also hath put away thy sin; thou shalt not die.
Now what we have here is a very brief account. David's repentance is not noted here in this passage but it is a good time to read Psa 51.
And then this...
Psa 130:1 A Song of degrees. Out of the depths have I cried unto thee, O LORD.
Psa 130:2 Lord, hear my voice: let thine ears be attentive to the voice of my supplications.
Psa 130:3 If thou, LORD, shouldest mark iniquities, O Lord, who shall stand?
Psa 130:4 But there is forgiveness with thee, that thou mayest be feared.
Back to the story...
2Sa 12:14 Howbeit, because by this deed thou hast given great occasion to the enemies of the LORD to blaspheme, the child also that is born unto thee shall surely die.
2Sa 12:15 And Nathan departed unto his house. And the LORD struck the child that Uriah's wife bare unto David, and it was very sick.
2Sa 12:16 David therefore besought God for the child; and David fasted, and went in, and lay all night upon the earth.
2Sa 12:17 And the elders of his house arose, and went to him, to raise him up from the earth: but he would not, neither did he eat bread with them.
2Sa 12:18 And it came to pass on the seventh day, that the child died. And the servants of David feared to tell him that the child was dead: for they said, Behold, while the child was yet alive, we spake unto him, and he would not hearken unto our voice: how will he then vex himself, if we tell him that the child is dead?
2Sa 12:19 But when David saw that his servants whispered, David perceived that the child was dead: therefore David said unto his servants, Is the child dead? And they said, He is dead.
2Sa 12:20 Then David arose from the earth, and washed, and anointed himself, and changed his apparel, and came into the house of the LORD, and worshipped: then he came to his own house; and when he required, they set bread before him, and he did eat.
David's life was filled with sorrow from this, yet his sins were forgiven.
One more big disappointment in his life...
1Ki 8:17 And it was in the heart of David my father to build an house for the name of the LORD God of Israel.
1Ki 8:18 And the LORD said unto David my father, Whereas it was in thine heart to build an house unto my name, thou didst well that it was in thine heart.
1Ki 8:19 Nevertheless thou shalt not build the house; but thy son that shall come forth out of thy loins, he shall build the house unto my name.
Same in our lives, God forgives sin, but justice is still done.