It’s a common misconception that the North was anti-slavery, and that’s the reason that the North went to war against the South. While the South side is fairly simple (it really was all about slavery and racism), the Northern side is a bit more complex.
There was an abolitionist movement in the U.S. for as long as the U.S. was a country (and even before it was a country). Abolitionism in the North mostly started with religions, especially the Quakers. In fact, the first anti-slavery laws in the U.S. were in states with large Quaker populations (Pennsylvania was first).
The abolitionist movement had been growing in the north all through the 1800s, but even by the time of the Civil War, the abolitionists were not strong enough politically or economically to take on the southern plantations.
But there was another north-south divide, the northern industrialists against the southern plantations. What was good for one was often not good for the other. For example, if you put taxes on goods from Europe, that made European goods more expensive and allowed northern factories to compete with European imported goods. But then Europe put taxes on things like tobacco and cotton, which hurt the plantation sales. Remove the taxes, and the plantations do better, but the northern factories do worse.
If you were a businessman or a banker, through the early 1800s, the Whig party was for you. They supported protective tariffs and other things that benefited business. But the Whig party collapsed around 1850-ish.
This is where you get into the old “the enemy of my enemy is my friend” situation. The abolitionists opposed the southern plantations, and the northern industrialists and businessmen opposed the southern plantations, so the two groups joined forces and created the new Republican Party. Each group alone could not defeat the southern plantations, but together, they won the 1860 election.
It’s important to note that about half of the Republican party really didn’t give two hoots about slavery and the other half of the party really didn’t give two hoots about northern factories (mostly - there were exceptions of course). But that didn’t matter. What the southern plantations saw was a single political party that voted against them both on slavery and on industrial/agricultural trade issues.
So what about the western territories?
Well, obviously, the abolitionist half of the Republican Party opposed slavery in the western territories because they opposed slavery everywhere. The industrialists didn’t give two hoots about about slavery, but they cared how these new states would vote, and they wanted these states on their side. Better to align them to the free states of the north. So even though the industrialists really didn’t care much about slavery, they cared how these states voted, and the new states being free states became a major part of the Republican Party’s platform in the 1860 election.
The South could see the writing on the wall. Lincoln promised the South that they could keep their slaves, but that didn’t matter. The South knew that with the new states becoming free states, the South would be outvoted, and their entire way of life was now in danger.
At that point, war was inevitable. The only question was where the first shot would be fired.