When Einstein introduced the cosmological constant in his theory of general relativity he did so because he was guided by the paradigm of the day that the universe was static (i.e. neither contracting nor expanding.)
The cosmological constant provided a way of balancing the gravitational contraction caused by matter. It
was latter discovered by Edwin Hubble that other galaxies appear to be receding away from us, that the universe was actually expanding. When Einstein heard and fully appreciated these observations, he declared that the inclusion of the cosmological constant was his "biggest blunder."
Einstein's mistake was not a mathematical one but rather a philosophical one made many times over the history of thought. Einstein held too strongly to the belief that the universe was static and thus was unable to appreciate the power of his theory's predictions of a dynamic universe. His error serves as an lesson to all thinkers, that we should never close our minds to new possibilities, even if the thought of the day is that they are impossible. Imagine how history would have been changed had Copernicus refused to accept his belief that the sun was actually the center of the solar system, or had Columbus thought he would have fallen off the edge of the Earth. It is hard to know where the next paradigm shift will come from, but we should always be waiting for it.
One of today's paradigms is that the universe went through a period of rapid expansion, called inflation, early in its history, which would have caused the universe to be spatially flat today. This flatness is one of the motivations behind considering the cosmological constant in present day cosmology. We also expect the existence of a cosmological constant due to the vacuum energy predicted by quantum mechanics. We don't yet know whether a non-zero cosmological constant exists in our universe, nor do we completely understand the theory behind it. Most likely, this understanding will elude us until a complete theory of both gravity and quantum mechanics is developed.
The fact that the cosmological constant is still debated today, almost a century after it was introduced by Einstein, and that it lies at the crossroads of quantum mechanics and gravity, makes one think that it was probably not Einstein's biggest blunder, but perhaps his greatest legacy.

1.18.99