I don't understand David's plan for God,
but I understand God's plan for David.
Now the Philistines gathered together all their armies to Aphek,
while the Israelites were camping by the spring which is in Jezreel.
1 Samuel 29:1
The Philistines mustered their army about forty miles from the camp of Israel and from the site of the coming battle. The Philistines had a two day or so march before reaching Jezreel. Had David continued with the Philistines, what would David have done? I don't want to impute evil intentions to David. It may have seemed to him that the kindness of the enemy was a great respite from the cruelty of his own countryman.
David had fled Israel, but the cruelty of Saul had driven him away from his inheritance and from the house of his God.
Unlike the armchair quarterbacks (the commentators), God has mercy on David when he is as low as a squished worm. When David lost the ability to cope, God graciously led David back to himself. God had a greater concern for the restoration of David than for the exposure of David's sin. God is gracious and full of mercy. God's plan for David was overflowing mercy.
All the way my Savior leads me;
What have I to ask beside?
Can I doubt His tender mercy,
Who through life has been my Guide?
Heav’nly peace, divinest comfort,
Here by faith in Him to dwell!
For I know, whate’er befall me,
Jesus doeth all things well.
Don't doubt the tender mercies of God!
For me to live is Christ.