Numbers 31:48

And the officers which were over thousands of the host, the captains of thousands, and captains of hundreds, came near unto Moses:

The officers who commanded Israel's thousands and its hundreds came before Moses after the campaign against Midian. That campaign was the army of Israel carrying out God's command to punish the Midianites. The punishment was for the Midianites having led Israel into sin.