A sporangium is an enclosure in which spores are formed. It can be a single cell or multicellular. All plants, most of ferns form sporangia at some point in their life cycle.
Sporangia can produce spores by mitosis, but are also the site of meiosis and produce genetically distinct haploid spores. Some ferns produce two kinds of spore-microspores and megaspores.