Testicular torsion occurs when a testicle rotates, twisting the spermatic cord that brings blood to the scrotum. The reduced blood flow causes sudden and often severe pain and swelling. Testicular torsion is most common between ages 12 and 18, but it can occur at any age, even before birth.