Of the options that you have given here, only B could be considered the right answer. All of the others are clearly wrong.
A cannot possibly be correct. Texas was not annexed by the United States until 1845. By that point, Mexico (to which Texas had belonged) had been independent of Spain for decades. Spain would not have gone to war over the annexation of Texas.
C cannot possibly be correct. It was the United States that annexed Texas. The US would not have gone to war with itself over the issue of Texas. If A and C are both incorrect, then D cannot be correct either.
B is the correct answer. The US and Mexico went to war largely over the issue of the annexation of Texas. Within the US, there was divisiveness between the North and South over the issue of slavery in the large new area that had been brought into the Union.