1 Samuel 17:12

Now David was the son of that Ephrathite of Beth-lehem-judah, whose name was Jesse; and he had eight sons: and the man went among men for an old man in the days of Saul.

David was the son of Jesse, the Ephrathite of Bethlehem-judah, and Jesse had eight sons. This places the verse in the account of David's family and shepherding life. When war against the Philistines was declared and renewed, three of Jesse's sons joined Saul's army. At that time David left Saul's service and was allowed to return to his father's house, where he remained at home to resume the shepherding he loved. The setting is the Philistine challenge that frightened Saul and all Israel, just before David went to face Goliath.

After a time Jesse sent David to Saul's camp to carry a message and a gift to his elder brothers and to learn whether they were safe and well. Unknown to Jesse, David went on a higher mission, directed by an angel to save his people when the armies of Israel were in peril. The larger passage of 1 Samuel 17:4-51 recounts David's victory over the Philistine champion, whose defeat David later recalled when he was recognized at Gath and faced danger.