When Saul suspected that David was going to take his throne, he tried to capture David to prevent this from happening. How long was Saul chasing David?
The short answer is: We don't know for sure because there are very few dates or ages given in the stories of Saul and David in the Bible.
We cannot even be certain of the length of Saul's reign, or of how old he was when he began to reign—information that is commonly provided for kings of Judah and Israel in the narratives of the Hebrew Bible. That information probably was originally contained in 1 Samuel 13:1. However, the Hebrew text in that verse seems to be corrupted, and the verse does not occur at all in the Septuagint (see that verse in the Blue Letter Bible).
Though Acts 13:21 states that Saul reigned for 40 years, this seems to be based on traditional sources, since the Hebrew Bible itself provides no length for Saul's reign. Or perhaps it is based on 2 Samuel 2:10, which states that Saul's youngest son Ishbaal, or Ish-bosheth, was 40 when he briefly succeeded Saul on the throne for the northern tribes. However, that age seems likely to be a scribal error. Ishbaal seems not even to have been of fighting age (20+, see Numbers 1:3) at the time of Saul's final battle and his death, when Ishbaal's three older brothers, who were of fighting age, died along with their father (see 1 Samuel 31). On this basis, some scholars believe that Saul's reign was probably only about twenty years long, and that Ishbaal was probably twenty years old at most when he succeeded his father.
We also do not know how old David was when he was anointed by Samuel to (eventually) succeed Saul as king in 1 Samuel 16:1–13. Nor do we know how old David was when King Saul first called him into service, in 1 Samuel 16:14-23. However, at that time, a servant of Saul describes David as, among other things, "a man of valor, a warrior, prudent in speech, and a man of good presence" (1 Samuel 16:18). Although some have pictured David as a mere teenager when he went into Saul's service, this description suggests that he was more likely a young man of fighting age, meaning at least twenty years old, at that time.
One age we do know is how old David was at the time he succeeded Saul as king of Judah in the south:
David was thirty years old when he began to reign, and he reigned forty years. At Hebron he reigned over Judah seven years and six months; and at Jerusalem he reigned over all Israel and Judah thirty-three years. (2 Samuel 5:4–5, emphasis added)
This beginning of David's reign as king took place shortly after Saul's death.
Combined with the above likely minimum age of David at the time he went into Saul's service, this suggests that Saul and David's interactions with one another took place over a period of a decade or less. However, once again, this is based on inference drawn from the story, since we have no definite ages or dates for the beginning of this time period.
The only other definite date/age figure we are given in the entire story is the time period David took refuge in Philistine territory to escape Saul's attempts to assassinate him:
The length of time that David lived in the country of the Philistines was one year and four months. (1 Samuel 27:7)
We are told a few verses earlier, in 1 Samuel 27:4, that Saul stopped pursuing David when Saul heard that David had fled to Philistine territory. It was only after Saul's death that David returned from Philistine territory to the territory of Judah, his own tribe. David is still in Ziklag, in Philistine territory near that of Judah, when he receives word of the death of Saul and his three eldest sons, and mourns their death (see 2 Samuel 1). He then at last returns to the territory of Judah, and is anointed king there, as told in 2 Samuel 2:1–7.
This means that the only definite timing we are given is that the final period of Saul's hostility against David, when David was out of Saul's reach in Philistine territory, lasted one year and four months.
Beyond that, we can only speculate and make educated guesses based on the narration of events between 1 Samuel 16, when David first went into Saul's service, and 1 Samuel 31, which tells the story of Saul's final battle and his death.
Such speculation and educated guesses would likely push this answer beyond the length parameters of this site.
However, one expression of previous efforts in this direction is found in the dating associated with the various chapters that is provided in some editions of the King James Version of the Bible. That dating places 1 Samuel 16, when David first enter's Saul's service, as well as the following two chapters, in which Saul begins to become jealous of David and to fear David, in 1018 BC, and 1 Samuel 31, in which Saul dies, in 1011 BC. Traditional Christian scholarship, then, has placed the time period in which Saul sought David's life and David fled from Saul at about seven years.
That time period also does not have any definitive biblical basis. However, it is probably as good an estimate as any for a time period whose length we simply do not know and cannot determine for certain.