For sexual reproduction  to occur the sex cells must be haploid. Their formation requires a diploid gamete mother cell to undergo division. Meiosis is the form of nuclear division that makes four haploid gametes from on diploid gamete mother cell. It occurs in the testes or the ovaries depending on the gender of the human.
Meiosis involves two divisions consecutively. Here are the stages of Meiosis
First Meiotic Division
  1. The long uncoiled chromosomes coil up and replicate forming two identical chromatids.
  2. Homologous chromosomes match up and crossing over occurs at the chiasma.
  3. These pairs of homologous chromosomes line up at the equator with the paternal (father) and maternal (mother) genes on random sides.
  4. The spindle fibres then contract from the poles and attach to one of the homologous chromosomes and pulls them to opposite poles.
  5. With the two homologous chromosomes at separate poles two nuclear membranes form and the cytoplasm divides to form two daughter cells. These daughter cells are haploid.

Second Meiotic Division (Mitosis)

  1. The chromosomes in each of the daughter cells line up at the equator.
  2. The spindle fibres retract and pull the chromatids to opposite poles.
  3. with the chromosomes at separate poles two new nuclear membranes form.
  4. 4 haploid gametes are now formed.

Independent Assortment and Crossing Over cause variation.

Here is a short video explaining both divisions.

YouTube Video