Israel came out of Egypt, and wandered in the wilderness 40 years under Moses. After Moses died, Joshua took Israel into the promised land, Canaan. Joshua had been told to kill all Canaanites, and the Lord gave them tremendous victories over every Canaanite nation they encountered.
In Joshua 9, we see that the inhabitants of Gibeon heard of the great success Joshua was having over all the nations, no matter how strong the nations were. And Joshua was getting too close for comfort.
So the Gibeonites devised a very clever plan, and persuaded Joshua to make an agreement with them. 2 Samuel 21:2, tells us that the Gibeonites genuinely converted to the Jewish religion; though not natural born Israelites, they enjoyed the safety God promised to his people in the land.
In 2 Samuel 21, we see that better than 400 years after Joshua made the agreement, the king before David, Saul, tried to kill off the Gibeonites, though the Gibeonites had kept their side of the agreement.
Toward the end of David's 40 reign, there was a famine in the land. After three years, David asked the Lord what the problem was. The Lord answered that it was because Saul had broken the agreement made with the Gibeonites when he tried to destroy them.
1) Canaan was a fruitful land, but there was a famine in it during the reign of godly king David. It was not extreme, or David would have checked with the Lord sooner.
2) David asked the Lord what was going on. Though David himself was a prophet, he still had to seek out others. At that time, when someone wanted to know something from the Lord, he went to the tabernacle before the high priest. The priest had what was called the Urim and Thummim. (Ex. 28:30.) No one knows really what the Urim and Thummim was, nor how the Lord spoke through them. But he did.
The point is that even godly king David had to get serious and seek why the Lord had a controversy with him and with the nation: I will say unto God, Do not condemn me; shew me wherefore thou contendest with me. (Job 10:2)
But he did not seek the Lord's mind in the matter until the famine was three years old. Even good men are often slack and remiss in doing what they should. We continue in ignorance and mistakes because we do not get down to business with the Lord.
3) David asked, and God answered -- It is for Saul. The events with Saul happened over 50 years previously, and God is just now holding the nation accountable.
A) God does not explain why he waited so long to bring the results to pass.
And all the inhabitants of the earth are reputed as nothing: and he doeth according to his will in the army of heaven, and among the inhabitants of the earth: and none can stay his hand, or say unto him, What doest thou? (Daniel 4:35 )
Not only can we not ask the Lord "WHAT?", but we cannot ask him "WHY?". "Why are you doing this or allowing this to be done, Lord?" Or "Why have you waited so long to show this, Lord?"
The Lord must open eyes, or eyes will not be opened to the truths of matters, even the truth of sins in our lives. If he does not open eyes, even Christians will perish in the results of their sins.
Psalms 69:5, O God, thou knowest my foolishness; and my sins are not hid from thee. (Ps. 69:5.)
Psalms 19:12, 13, Who can understand his errors? cleanse thou me from secret faults. 13 Keep back thy servant also from presumptuous sins; let them not have dominion over me: then shall I be upright, and I shall be innocent from the great transgression. (Ps. 19:12, 13.)
Psalms 139:23, 24 Search me, O God, and know my heart: try me, and know my thoughts: 24 And see if there be any wicked way in me, and lead me in the way everlasting. (Ps. 139:23, 24.)
It is both God's work and God's timing that opens eyes to the reality of what is going on. Why did not God show David at the start of his reign the sin that was going to cause the famine years latter? Many times sin is hidden from us for a length of time. Saul's foolishness was hidden from David for probably a generation.
B) The guilt of sin does not fade with time with the Lord.
For thus saith the high and lofty One that inhabiteth eternity, whose name is Holy; I dwell in the high and holy place, with him also that is of a contrite and humble spirit, to revive the spirit of the humble, and to revive the heart of the contrite ones. (Isaiah 57:15 )
In fact, there is no time with the Lord. Time was created by God for man, not for himself.
C) Because the Lord might allow "good times" to continue does not mean the Lord has forgotten. David prospered in everything he did, but in God's timing, he held the nation accountable for what Saul did many years previously.
Psalms 50:21 These things hast thou done, and I kept silence; thou thoughtest that I was altogether such an one as thyself: but I will reprove thee, and set them in order before thine eyes. (Ps 50:21.)
Romans chapter 2, as well as multitudes of other passages, tells us that because God does not move speedily against the things men do, men feel the Lord has forgotten or has overlooked them. Maybe because God might continue his blessings or not hold us accountable right now, what we did was not too bad or was even OK.
And again, I need to point out that this can refer to both good and bad things we do. We sow godliness in our lives properly, and because we do not reap the good things promised by the Lord within our time frame, we feel he has forgotten us.
D) It was not Saul's generation that reaped the results of Saul's actions against the Gibeonites. Saul's generation passed away, but the Lord did not pass away nor forget what Saul did:
Exodus 20:4 Thou shalt not make unto thee any graven image, or any likeness of any thing that is in heaven above, or that is in the earth beneath, or that is in the water under the earth: 5 Thou shalt not bow down thyself to them, nor serve them: for I the LORD thy God am a jealous God, visiting the iniquity of the fathers upon the children unto the third and fourth generation of them that hate me; 6 And shewing mercy unto thousands of them that love me, and keep my commandments.
There is no statute of limitations with the Lord. The results of actions, good or bad, many be delayed, but they will not be avoided.
Are you facing a famine in your life, particularly in your spiritual life?
23 Search me, O God, and know my heart: try me, and know my thoughts: 24 And see if there be any wicked way in me, and lead me in the way everlasting. (Ps. 139:23, 24.)
I will only say one thing about guilt at this time. The enemy of our souls will heap guilt upon guilt upon us. We can easily identify guilt as a work of the enemy because he gives no Scriptural answer for the guilt.
And I will restore to you the years that the locust hath eaten, the cankerworm, and the caterpiller, and the palmerworm, my great army which I sent among you. (Joel 2:25.)
Additional:
2 Samuel 24:10-25, David sinned in numbering the people. Given a choice, he chose three days pestilence upon the land. The Lord in his mercy cut it short.