More accurately, he wanted to "save the union", regardless of slavery.
Thus, Lincoln's desire for the Union do not contradict his views on slavery.