These were related because many in the North believed that the annexation of Texas and the war with Mexico (pretty much both the same issue) were meant to help the South and to expand slavery.
If you remember, before the 1840s, the number of slave and free states were equal and the issue had been pretty well "solved" by the Missouri Compromise. But then came the issue of Texas and the war. All of a sudden there might be way more territory in the US and a lot of it would be in the south. Northerners thought that this was going to be a huge advantage for the South because slavery would spread into the new territories and they would become slave states.