When two objects collide the total momentum before the collision is equal to the total momentum after the collision (in the absence of external forces). This is the law of conservation of momentum.
An object being fired from a cannon is also a collision where momentum must be conserved. As the momentum before the 'collision' is zero, the momentum after the collision is zero. In physics ...