"Does magnetism curve space?" is a very interesting question. If we think that at some point, or under certain conditions, all of the forces can be unified, and if we also view the force of gravity as being the result of curved space-time, then it suggests that space-time geometry is significant, in some way, to the other forces as well. I dunno the answer to that.
We don't seem to live in a flat universe though. The options are flat & closed, flat & open, curved & closed and curved & open.
In a flat & open universe, the uninterrupted photon will not return to it's origin. In a flat & closed universe the photon will be either lost entirely, when it reaches the boundary, or will reappear at a point somewhere else on the boundary, and so may return to its origin (if the photon is lost then eventually everything in the universe will be lost, given enough time).
In a curved & closed universe, the photon will return, but in a curved & open universe it won't.
Whether the photon returns to its origin then, seems to be more down to whether the universe is open or closed and not what shape it is.