Your question should really be, "Why didn't all the slave states secede?" And the answer to that is, the felt secession was a worse option than remaining part of the United States. But as a matter of fact, out of the 25 states loyal to the United States, 20 had outlawed slavery before the war. One, West Virginia, entered as a slave state (the legacy of formerly being part of Virginia), but quickly outlawed it. Two more outlawed it during the war. The 13th amendment abolished slavery throughout the United States, but it took the election of 1864 to get enough Democrats out of congress to allow it to pass.
The key to everything bad about America.