On average it's a requirement of the conservation of momentum. But note that sometimes photons come out in a different direction (scattered), including to opposite direction (reflection). In these cases the momentum is absorbed by the medium.
(It may help to observe that an object with nonzero mass moving at the speed of light would have infinite momentum, and then it maybe makes sense that "zero times infinity" becomes a finite number)