Because he didn't want to push for a Brexit when it had the support of some very right wing people who probably wanted to use Brexit to relax things like environmental laws, consumer protection and worker's rights among other things. Pretty simple political pragmatism.
I voted to leave in the end, despite these concerns (which are why I was undecided for ages), but I can totally understand why Corbyn was on the remain side.