Did he knew about the Michelson-Morley experiment?
He just knew the name of the experiment not any details. The experiment didn't play any role in the formulation of STR by Albert Einstein.
The context is taken from the book:
Special Theory of Relativity
by V. A.; Atanov, Yuri (Trans.) Ugarov (Author)
Art: Was Michelson's experiment "decisive" for the creation οΙ
the special theory οΙ relativity?
An article by R. Shankland,
published in 1963, the following excerpt from his interview with
Einstein dating back to 1950:
"When Ι asked him how he had learned of the Michelson Morley experiment, he told me that he had become aware of it through
writings of Η. Α. Lοrentz, but only after 1905 had it come to his
attention! "Otherwise" he said, "I would have mentioned it in my
paper!" indeed, Einstein's 1905 paper contains no mention of Μichelson's experiment or references to Lorentz's papers."
A letter written by Albert Einstein:
"Ιn my own development Michelson's result had not had a considerable influence. Ι even do not remember if Ι knew of it at all when I wrote my first paper on the subject (1905). Τhe explanation is that Ι was, for general reasons, firmly convinced how this could be reconciled with our knowledge οf electro-dynamics. One can therefore understand why in my personal struggle Michelson's
experiment played no role or at least no decisive role..."
There is an alternate formulation to special relativity, Lorentz Ether Theory. This alternate theory allows the ether frame to still exist. Nobody teaches it. Why?
Special relativity makes two very simple assumptions, that the laws of physics are the same in all inertial frames, and that the speed of light is the same to all inertial observers. The Lorentz transformation and everything implied by it follow from these simple assumptions.
Lorentz Ether Theory on the other hand posits a special frame, the ether frame, where Maxwell's laws truly do hold. Per this theory, this is the only frame in which the one-way speed of light is Maxwell's c. Lorentz Ether Theory also posits time dilation and length contraction as axiomatic. These lead to the Lorentz transformation, and to the round trip speed of light being Maxwell's c.
The only way to distinguish these two theories is to find a way to measure the one-way speed of light. That's not possible, and thus there is no way to experimentally distinguish the two theories. Yet physics instructors only teach special relativity. You have to dig deep, very deep, to find proponents of Lorentz Ether Theory.
One reason is that the assumptions of time dilation and length contraction as axiomatic seem rather ad hoc (and that's putting it nicely). An even bigger reason is that Lorentz Ether Theory introduces a key untestable hypothesis, the existence of the ether frame. This frame cannot be detected. Time dilation and length contraction conspire to hide it from view. A bigger reason yet is general relativity. The axioms of Lorentz Ether Theory are inconsistent with general relativity. The final nail in the coffin is quantum mechanics, which eliminates the need for a medium through which light propagates. Without that very self-contradictory medium (the luminiferous aether), what's the point of having an ether frame?
The modern geometrical perspective of special relativity isn't so much that the speed of light is constant but rather that there exists some finite speed that is the same to all observers, and that light necessarily moves at this speed because it is carried by massless particles.
What motivates the existence of this finite universally agreed upon speed is geometry. What geometries yield a universe in which Newtonian mechanics appears to hold in the limit of zero velocity, and what do these geometries say about a speed that is the same to all observers?
The answer is that there are two cases: This universally agreed upon speed is infinite or finite. An infinite universally agreed upon speed results in Newton's universe. A finite speed results in Minkowski space-time describing the geometry of special relativity. Experimentally, the finite speed of light appears to be the same to all observers, thus falsifying the notion of a Newtonian universe with Euclidean space and time as the independent variable.
Best Answer
A lot of people find it somewhat surprising, but Einstein's initial formulation of special relativity was in a paper, On the electrodynamics of moving bodies, that makes very little reference to the Michelson-Morley result; instead, it is largely based on the symmetry of electromagnetic analyses in different frames of reference.
From a more modern perspective, there is a strong theoretical case to be made that special relativity is, at the very least, a strong contender for the description of reality. These are beautifully summed up in Nothing but Relativity (doi), but the argument is that under some rather weak assumptions, which are essentially
you are essentially reduced to either
with no other options.
To get to reality, you need to supplement this theoretical framework with experiment - there's no other way around it. The Michelson-Morley experiment is, of course, the simplest piece of evidence to put in that slot, but in the intervening century we have made plenty of other experiments that fit the bill. From a purely mechanical perspective, the LHC routinely produces $7\:\mathrm{TeV}$ protons, which would speed at about $120c$ in Newtonian mechanics: it is very clear that $c$ is a universal speed limit, because we try to accelerate things faster and faster, but (regardless of how much kinetic energy they hold) they never go past $c$.
If you want something from further back, this is precisely the reason we developed the isochronous cyclotron in the late 1930s and then switched to synchrotrons back in the 1950s - cyclotrons require particles to keep in sync with the driving voltage, but if they approach the speed of light they can no longer go fast enough to keep up. We have upwards of eighty years of history of being able to mechanically push things to relativistic regimes.
If you wish for an answer inscribed within "experimental physics as of 1888, minus the Michelson-Morley result" then, as I said, the symmetry properties of electromagnetism (which are directly compatible with SR as derived from $v\ll c$ experiments, but require aether theories to make sense in galilean relativity) were plenty to convince Einstein that SR was the right choice.
Edit:
As pointed out in a comment, Einstein's original paper does make some reference to Michelson-Morley(-type) experiments, in his second paragraph:
However, apart from this small nod, he makes no substantive references to the aether or its equivalents: the paper starts with the relativity postulates (based on the constancy of the speed of light), uses those to construct special relativity (as pertains transformations between moving frames, and so on), and then builds his case for it on the transformation properties of the equations of electromagnetism: these provide the deeper fundamental insight that underlies the symmetry of analysis of electromagnetic situations performed on different moving frames of reference.