There are two main ways this could have happened.
First, the CSA could have won the war. This would have resulted in a hugely different world. The United States would no longer have existed as a single country. We can imagine things such as the CSA and the USA getting into WWI on opposite sides. This would have been tremendously different simply because there would be no USA as we know it to take its place on the world stage.
Second, the USA could have won the war and not freed the slaves. This would probably not have made much difference in the long term. Slavery would have died slowly rather than quickly as it became economically uncompetitive. The US would have remained united and probably not much less racially unjust than it continued to be in reality for the rest of the 1800s.