Yes, slavery really was the underlying cause of the war. This is something I've written about at length before, so I would direct you here.