The answer is; crossing over/synapsis
This occurs when the arms of homologous non-sister chromosome pairs connect at points called chiasma. They exchange genetic material causing recombination. This mostly occurs in the later stages of prophase I into metaphase I of meiosis. Flaws in crossing over can cause genetic diseases in offspring.