Commentators explain that David didn't flee randomly; he intentionally sought out the prophet Samuel. He went for advice, comfort, and to have his faith strengthened by the man who had anointed him king. As one scholar notes, David was making God his refuge by going to God's prophet, seeking rest in 'Samuel's church' after the turmoil of Saul's court.