According to wikipedia Maxwell's equations were an essential inspiration for Einstein's development of special relativity. Possibly the most important aspect was their denial of instantaneous action at a distance. So exactly how maxwell theory of electromagnetism solved action at a distance problem ?
1) Typically, you rectify action-at-a-distance when you make your degrees of freedom local, that is, dependent on space and time (giving you a field). The equations of motion then tell you the evolution of these degrees of freedom in space and time, instead of having some sort of global character that action-at-a-distance entails.
2) The degrees of freedom (electric and magnetic fields) follow wave equations with the finite velocity (phase/group) of propagation given by the speed of light.
There were two worrying things about Newtonian gravity. The first is that there seemed to be no mediator between bodies that made them attract each other, and the second is that the effects of gravity seemed to be instantaneous, so a movement of a body could have an effect on a distant body without any time delay.
Although electromagnetism is a different force than gravity, it showed us a hint of how the concerns above might possibly be solved for gravity (which was done by general relativity in the end).
First, Maxwell's equations together with the Lorentz force law show that conservation of momentum seems to be violated unless you appropriately define and include the momentum of the fields. This indicates that the $E$- and $B$-fields are (or represent) real entities that carry momentum. Same with energy (by similar reasoning).
Second, Maxwell's equations tell you that the fields can change in time by themselves. In particular, you can tell how the field at a point can change based on how the field behaves around that point, which means the behavior is local. This is unlike what was thought about the gravitational field where it couldn't change by itself and depended only on the particles instantaneously.
With these two things in mind, you can see how a moving charge has an effect on another distant charge. When you push one charge, it generates (a change in) the $E$- and $B$-fields around itself, and then those (changes in) $E$- and $B$-fields propagate outward at the speed of light. Then after some time the (change in) $E$- and $B$-fields reaches the distant charge and moves it accordingly. So the answer to the two concerns at least for electromagnetism are solved: the fields are the mediators that carry momentum, and the effects propagate at a finite speed.