There are two major ideas/names to keep in mind when thinking about this question. They are manifest destiny and Frederick Jackson Turner. These two show how the subjugation of the Indians and the westward expansion that went with it promoted national unity.
Manifest destiny is, of course, the idea that the US was assigned by God to spread across the continent. The US deserved this because of its superior government, culture, and "blood." Turner argued that the frontier is what defined America. The frontier gave Americans an identity as tough, independent pioneers.
Between them, these things increased national unity. They created an identity that all Americans could share. America was a country singled out by God to fight against Indians and others on the frontier as a way of improving the world. This view of America's mission helped to boost national unity.
The addition of territory in the frontier lands, and the subjugation of the Native tribes there opened up vast new territories for settlement and agriculture.
While sectional tension between slave-based economies and those of the North had been growing ever since the Constitution, the addition of these new lands threw gasoline on the fire. The omnipresent question in the legislature and economic circles became "Would the new territories have legal slavery or be designated as free"?
As notable figures like Senator Henry Clay successfully compromised on the slave-free debate with the Missouri Compromise of 1820 and the Compromise of 1850, along with the Fugitive Slave Act, the amount of sectional tension grew in proportion to the number of slaves and slave territories.
Historians often argue that the Civil War was inevitable at some point, but many historians also argue that the reason it was in the early 1860s was because westward expansion forced the issue.