String Theory and the Idea of an Expanding Universe
Before string theory, Albert Einstein was strongly influenced by the concept of an unchanging universe. His general theory of relativity predicted a dynamic universe — one that changed substantially over time — so he introduced a term, called the cosmological constant, into the theory to make the universe static and eternal.
This would prove to be a mistake when, several years later, astronomer Edwin Hubble discovered that the universe was expanding! Even today, the consequence of the cosmological constant in general relativity has enormous impact upon physics, causing string theorists to rethink their whole approach.
The equations of general relativity that Einstein developed showed that the very fabric of space was expanding or contracting. This made no sense to Einstein, so in 1917 he added the cosmological constant to the equations. This term represented a form of repulsive gravity that exactly balanced out the attractive pull of gravity.
When Hubble showed that the universe was indeed expanding, Einstein called the introduction of the cosmological constant his “biggest blunder” and removed it from the equations. This concept would return over the years, however. With the discovery of dark energy, Einstein’s “blunder” was found to be a necessary parameter in the theory (even though physicists for most of a century assumed the cosmological constant’s value was zero).
Discovering that energy and pressure have gravity
In Newton’s gravity, bodies with mass were attracted to each other. Einstein’s relativity showed that mass and energy were related. Therefore, mass and energy both exerted gravitational influence. Not only that, but it was possible that space itself could exert a pressure that warped space.
When Einstein created his first model based on the general theory of relativity, he realized that it implied an expanding universe. At the time, no one had any particular reason to think the universe was expanding, and Einstein assumed that this was a flaw in his theory.
In a de Sitter space, the only thing that exists is the energy of the vacuum — the cosmological constant itself. Even in a universe containing no matter at all, this means that space will expand. A de Sitter space has a positive value for the cosmological constant, which can also be described as a positive curvature of spacetime.
A similar model with a negative cosmological constant (or a negative curvature, in which expansion is slowing) is called an antide Sitter space.
In 1922, the Russian physicist Aleksandr Friedmann turned his hand to solving the elaborate equations of general relativity, but decided to do so in the most general case by applying the cosmological principle (which can be seen as a more general case of the Copernican principle), which consists of two assumptions:

The universe looks the same in all directions (it’s isotropic).

The universe is uniform no matter where you go (it’s homogenous).
With these assumptions, the equations become much simpler. Einstein’s original model and de Sitter’s model both ended up being special cases of this more general analysis. Friedmann was able to define the solution depending on just three parameters:

Hubble’s constant (the rate of expansion of the universe)

Lambda (the cosmological constant)

Omega (average matter density in the universe)
To this day, scientists are trying to determine these values as precisely as they can, but even without real values they can define three possible solutions. Each solution matches a certain “geometry” of space, which can be represented in a simplified way by the way space naturally curves in the universe, as shown in the figure:

Closed universe: There is enough matter in the universe that gravity will eventually overcome the expansion of space. The geometry of such a universe is a positive curvature, such as the sphere in the leftmost image in the figure. (This matched Einstein’s original model without a cosmological constant.)

Open universe: There isn’t enough matter to stop expansion, so the universe will continue to expand forever at the same rate. This spacetime has a negative curvature, like the saddle shape shown in the middle image in the figure.

Flat universe: The expansion of the universe and the density of matter perfectly balance out, so the universe’s expansion slows down over time but never quite stops completely. This space has no overall curvature, as shown in the rightmost image of the figure. (Friedmann himself didn’t discover this solution; it was found years later.)
These models are highly simplified, but they needed to be because Einstein’s equations got very complex in cases where the universe was populated with a lot of matter, and supercomputers didn’t yet exist to perform all the math.