David was the youngest son. While his three oldest brothers went to war with Saul, David went back and forth from attending to Saul to tending his father's sheep in Bethlehem.
NKJV
But David occasionally went and returned from Saul to feed his father's sheep at Bethlehem.
PHILIPS
RWEBSTR
But David went and returned from Saul to feed his father's sheep at Bethlehem.
GWV
David went back and forth from Saul's camp to Bethlehem, where he tended his father's flock.
NET
David was going back and forth* from Saul in order to care for his father’s sheep in Bethlehem.
NET
17:15 David was going back and forth494
tnHeb “was going and returning.”
from Saul in order to care for his father’s sheep in Bethlehem.