Before Hubble and others discovered that galaxies are receding away from us and that therefore the Universe must be expanding, Einstein predicted from his Theory of Relativity that if the Universe contains any matter at all [which it obviously does!], then it must either be expanding or contracting. Einstein was an unconventionally but deeply religious man, once stating: "I want to know how God created this world. I want to know His thoughts. The rest are details." He firmly believed from a religious/philosophical perspective that the Universe must be static so he introduced a mathematically permissible but otherwise ad hoc constant (called the "Cosmological Constant") into his solution to force a static result; it produces a repulsive force to counteract gravity. Because it was driven by philosophy and not observation, he later viewed this as his biggest mistake! (picture from http://www.th.physik.uni-frankfurt.de/~jr/physpiceinstein.html)
Georges Lemaitre realized a few years later (in the 1930s) that Hubble's observations of receding galaxies coupled with both his and Aleksandr Friedmann's solution to Einstein's equations proved that the Universe must be expanding. (picture from R. McCray, http://cosmos.colorado.edu/astr1120/lesson12.html) Einstein was not initially supportive, writing:
The results concerning the non-stationary world, contained in [Friedmann's] work, appear to me suspicious. In reality it turns out that the solution given in it does not satisfy the field equations.
but later he realized the mistake was his:
In my previous note I criticised [Friedmann's work On the curvature of Space]. However, my criticism, as I became convinced by Friedmann's letter communicated to me by Mr Krutkov, was based on an error in my calculations. I consider that Mr Friedmann's results are correct and shed new light.
Recent observations of white-dwarf supernovae suggest that the Universe is now accelerating its expansion, causing us to re-invent the cosmological constant and to believe it might have been Einstein's biggest insight! (pictures from http://www.rbe.net.au/~staylord/einstein.html, http://www.th.physik.uni-frankfurt.de/~jr/physpiceinstein.html, http://charm.physics.ucsb.edu/people/hnn/physicists.html