|"The special theory of relativity owes its origin to Maxwell's equations of the electromagnetic field. Conversely, the latter can be grasped formally in satisfactory fashion only by way of the special theory of relativity." Einstein, written in 1946 for "Autobiographical Notes"|
Newtonian mechanics assumes time and space to be unrelated absolutes, and is fundamentally based on the principle of relativity first enunciated by Galileo Galilei in 1632 in his Dialogue Concerning the Two Chief World System. In its modern formulation, this principle states that laws of mechanics are the same for all the inertial observers, or from a more theoretical point of view, that these laws are invariant under Galilean transormations. There is no special concern about the speed of light.
In 1865, in his Dynamical Theory of the Electromagnetic Field the Scottish scientist James Clerk Maxwell (1831-1879) formulated the theory of classical electromagnetism, bringing for the first time together electricity, magnetism and light as the same phenomen.
In the Maxwell's equations as formulated by Lorentz in 1895, only in one "aether" frame is the speed of light constant in all directions and independant of the speed of the source. In all other inertial frames, the equations are not the same, meaning that the Maxwell equations are not unvariant under Galilean transformations.
One of the two theories, the old respectable Newtonian mechanics or the most recent Maxwell's electromagnetism has then to be proven wrong.
Einstein who devoted boundless admiration for the elegance of these four differential equations, took this constancy of speed of light as a postulate, generalized to all inertial frames, and abandoned the aether hypothesis.
It was even more easy for Einstein to rule out this stationary aether, as the so called Michelson-Morley experiment performed over the summer of 1887 failed to detect it .
In 1912 Einstein wrote:
"It is impossible to base a theory of the transformation laws of space and time on the principle of relativity alone. As we know, this is connected with the relativity of the concepts of "simultaneity" and "shape of moving bodies." To fill this gap, I introduced the principle of the constancy of the velocity of light, which I borrowed from H. A. Lorentz’s theory of the stationary luminiferous ether, and which, like the principle of relativity, contains a physical assumption that seemed to be justified only by the relevant experiments (experiments by Fizeau, Rowland, etc.)"
"Einstein's inspiration on the road to special relativity was the mathematical beauty of Maxwell's equations, which impressed him to such a degree that he decided to take seriously the prediction that speed of light is a constant" (Extract from Why does E=mc2 from Brian Cox and Jeff Forshaw)
You can read an interesting thread with the following subject: Was Einstein's postulate for the speed of light a consequence of Maxwell's equations?
An interesting contextualization to Einstein's special theory can be found here: Spacetime of special relativity
 The term absolute means two different things here: space and time are the same for every observer, but also space and time are not affected by the presence of matter or energy. The first aspect is the one which will be called into question by Special Relativity theory whereas the second aspect will be examined by the General Relativity.
 The extent to which the null result of the Michelson–Morley experiment influenced Einstein is disputed. Alluding to some statements of Einstein, many historians argue that it played no significant role in his path to special relativity, while other statements of Einstein probably suggest that he was influenced by it.