In ferns, meiosis takes place during :
Formation of spores.
In alternation of generations, in Bryophytes and Pteridophytes (ferns) the gametophyte is haploid and produces gametes by mitosis.
When fertilization occurs the gametes join to form a diploid sporophyte. The sporophyte undergoes meiosis to produce haploid spores which will give rise to the gametophyte.