Sperm have flagella, which are whip-like tails that allow them to swim. In order to swim, they need water. This means ferns can only successfully reproduce in wet places, or after a rain. After fertilization, the sporophyte grows up on top of the gametophyte.
Bryophytes also need a moist environment to reproduce. Their flagellated sperm must swim through water to reach the egg. So mosses and liverworts are restricted to moist habitats. ... They grow directly out of the fertilized egg in the archegonia, and remain dependent on the parent gametophyte for their nutrition.