Erections occur when blood rushes into the corpus spongiosum and corpus cavernosa, causing them to fill up and become erect.