My guess is that there was something of big value in god valley that both xebec and Roger were after.
To get it they had to confront marines, celestial dragons and each other. But if Roger wouldn't harm the slaves, xebec wouldn't care and that's why garp sided with Roger. They won and Roger took what he came for, maybe the big egg we saw on his boat or something else.