The life cycle of every plant in the plant kingdom includes what's known as "alternation of generations." This means that genetically, each species has two forms - a gametophyte and a sporophyte - which alternate with each other. Gametophytes produce sporophytes, and sporophytes produce gametophytes.
Gametophytes are haploid, which means they have one full set of chromosomes. They produce gametes through mitosis. Gametes are either male or female, and gametophytes may produce only male, only female, or both. Male and female gametes unite to form zygotes, which are diploid, or have two full sets of chromosomes. The zygotes become diploid sporophytes, which produce spores through meiosis that are haploid. The haploid spores then become more gametophytes.

click to enlarge
In some species of plants, the two forms are separate, free-living and independent of each other. Some are isomorphic, or with forms that are indistinguishable from each other. Examples of species with isomorphic alternation of generations can be found among green algae. Other species, most notably ferns, have heteromorphic alternation of generations. In some cases the two forms are so completely different in appearance and ecological niches that past botanists sometimes mistakenly classified them as separate species.