It was an Irish physicisist (what was his name?) who first suggested that the null result of the M-M experiment might be due to a compression of the apparatus along the direction of motion of the ether. THis idea was part of the reluctance to let go of the notion ofth ether which physics had devoted so much time and theory to. Lorentz then came up with his contraction formula. SO it was, initially, used for length contraction as caused by the ether.
Special relativity was produced by Einstein due to completely separate initial assumptions (the postulates) which require there to be no absolute reference frame, and therefore no ether. IT just so happened that SR required there to be length contraction along the direction of relative motion, and the formula for this contraction was exactly the same as the one developed by Lorentz.