Possible meanings are 1) the word "thousand" represents the exact amount of soldiers that he would lead. AT: "a commander of 1,000 soldiers" or 2) the word translated as "thousand" does not represent exact number, but is the name of a large military division. AT: "a commander of a large military division" See how you translated a similar phrase in [1 Samuel 17:18](../17/17.md). (See: [[rc://en/ta/man/translate/translate-numbers]])
Here "the people" refers to the soldiers under David's command. The phrases "went out" and "came in" are idioms that refer to leading the people into battle and leading them home from battle. AT: "David led his soldiers into battle and led them home from battle" (See: [[rc://en/ta/man/translate/figs-idiom]] and [[rc://en/ta/man/translate/figs-explicit]])