While the pregnancy was a significant storyline in the show, the baby was not real. The actress, Dianna Agron, was not pregnant during filming.
The baby, named Beth, was played by various infants, and the pregnancy was portrayed using various props, special effects, and techniques common in film and television.
The show's creators used the pregnancy storyline to explore complex themes like teen pregnancy, adoption, and social stigma.