Final answer:
The government's main motivation in passing the Homestead Act of 1862 was to encourage people to settle and farm western lands.
Step-by-step explanation:
The government's main motivation in passing the Homestead Act of 1862 was option B: to encourage people to settle and farm western lands. The Homestead Act provided incentives for settlers to move west by granting them 160 acres of federal land if they resided on the property for five years and improved it. This act not only promoted westward migration but also aimed to increase agricultural output for the war effort.