Yes, past surgeries and medical conditions can affect male fertility, though the impact depends heavily on which procedure or condition is involved and whether it's been addressed. Some affect sperm production, others affect sperm transport, and many can be managed or worked around with the right information and care.
Yes, they can—but the answer is more nuanced than a simple yes or no. Some surgeries and medical conditions have a direct, well-documented effect on sperm production, sperm transport, or hormone signaling. Others have no impact at all, or only matter if you don't know what to watch for. The key is understanding which ones matter, how they matter, and what you can actually do about it.
Let's walk through the most common scenarios.
Surgeries That Can Affect Fertility
Testicular surgery (varicocele repair, torsion, undescended testicle repair)
The testicles are where sperm is made, and blood flow is critical for keeping them at the right temperature. Varicocele repair—a surgery to fix enlarged veins in the scrotum—is actually one of the most common procedures done to improve fertility, not harm it. But any surgery near the testicles carries a small risk of damaging the blood supply or the vas deferens (the tube that carries sperm). If you've had testicular torsion (when the testicle twists, cutting off blood flow), that's a medical emergency. Even with successful surgery, the affected testicle may produce less sperm long-term.
Hernia repair (inguinal hernia)
This one is worth knowing about. Inguinal hernia repair, especially in infancy or childhood, can sometimes damage the vas deferens. A 2012 study in the Journal of Pediatric Surgery found that up to 2% of boys who had hernia repair before age 2 had some degree of vas deferens injury. In adults, the risk is lower, but it's not zero. If you had hernia surgery as a child and are now struggling with fertility, a simple semen analysis can rule out a blockage.
Prostate surgery
The prostate sits right below the bladder and surrounds the urethra. Surgery on the prostate—whether for cancer (radical prostatectomy) or for benign enlargement (TURP)—can affect ejaculation. In radical prostatectomy, the prostate and seminal vesicles are removed, so there is no ejaculate. In TURP, semen may flow backward into the bladder instead of out (retrograde ejaculation). Neither surgery stops sperm production itself, but both change how sperm gets out. If you're planning a family, sperm banking before surgery is standard advice.
Vasectomy
This is the most common male fertility surgery in the world, and it's designed to be permanent. The vas deferens is cut or blocked. Vasectomy reversal is possible, but success rates drop the longer you wait. After 10 years, the chance of a successful reversal is around 50% (according to data from the Cleveland Clinic). Vasectomy does not affect testosterone or sexual function—only the presence of sperm in ejaculate.
Medical Conditions That Can Affect Fertility
Varicocele
This isn't a surgery, but it's the most common correctable cause of male infertility. A varicocele is a dilation of the veins in the scrotum, similar to varicose veins in the leg. It raises scrotal temperature, which impairs sperm production. About 15% of all men have a varicocele, but it's found in 40% of men being evaluated for infertility. The fix is a relatively minor outpatient procedure, and studies show improvement in sperm count and motility in about 70% of men who have it repaired.
Infections
Mumps after puberty is the classic example. Mumps orchitis (inflammation of the testicles) can permanently damage sperm-producing tissue. A 2017 review in Human Reproduction Update noted that about half of men who get mumps orchitis have some degree of testicular atrophy. Other infections—like epididymitis, prostatitis, or STIs (chlamydia, gonorrhea)—can cause scarring in the reproductive tract, blocking sperm transport. Most are treatable with antibiotics, but scarring can be permanent.
Diabetes and metabolic syndrome
This one flies under the radar. High blood sugar damages blood vessels and nerves, including those that control erection and ejaculation. But it also affects sperm quality directly. A 2020 meta-analysis in Andrology found that men with diabetes had significantly lower sperm concentration and motility compared to healthy controls. The mechanism appears to be oxidative stress—high glucose creates free radicals that damage sperm DNA. The good news: improving blood sugar control through diet, exercise, and medication can reverse some of this damage.
Thyroid disorders
Both hyperthyroidism and hypothyroidism can mess with sperm production. The thyroid gland controls your metabolic rate, and when it's off, your testicles don't get the right hormonal signals. A 2015 study in Thyroid found that men with untreated hyperthyroidism had lower sperm counts that improved once their thyroid levels normalized. If you have unexplained fertility issues and haven't had your thyroid checked, it's worth asking your doctor.
Cancer (and its treatment)
This is the heavy one. Testicular cancer, lymphoma, and leukemia can all directly affect fertility—either by damaging the testicles or because the treatment (chemotherapy, radiation) kills sperm-producing cells. The good news is that sperm banking is highly effective and widely available. If you're a man of reproductive age facing a cancer diagnosis, banking sperm before treatment should be part of the conversation. Studies show that even men with low sperm counts can often bank enough for future IVF.
What You Can Actually Do
If you've had surgery:
- Ask your surgeon if the procedure involved the vas deferens, testicles, or prostate.
- If you're planning children, a semen analysis is the simplest way to check. It's cheap, non-invasive, and gives you a baseline.
- For vasectomy, consider sperm banking before the procedure if you're not 100% sure about your future plans.
If you have a medical condition:
- Get it under control. Diabetes, thyroid issues, and infections are all treatable. Treating the underlying condition often improves fertility.
- If you've had mumps or a serious infection, ask your doctor about a semen analysis.
- If you're on long-term medication (like for high blood pressure or depression), check if it has fertility side effects. Some beta-blockers and SSRIs can affect sperm quality or ejaculation.
General advice:
- A semen analysis is the single best test for male fertility. It measures count, motility, and morphology. If you're trying to conceive and it hasn't happened in 6 to 12 months, get one.
- Your doctor can help interpret the results and refer you to a urologist if needed. This is not something to guess about.
The Bottom Line (But Said Differently)
Past surgeries and medical conditions can affect fertility, but most of the time, they don't have to be a permanent barrier. The men who run into trouble are the ones who don't know what to look for, or who assume everything is fine until it isn't. A few simple checks—a semen analysis, a physical exam, and a conversation with your doctor about your history—can tell you exactly where you stand. And if there is a problem, there are options. Modern fertility treatment can work around most blockages, low counts, and even ejaculation issues.
The point is not to worry. The point is to know.
Frequently asked questions
can hernia surgery as a child affect fertility later in life
It's possible. Inguinal hernia repair, particularly when done in infancy or childhood, can sometimes damage the vas deferens, which is the tube that carries sperm. A study in the Journal of Pediatric Surgery found that up to 2% of boys who had hernia repair before age 2 had some degree of vas deferens injury. If you had the surgery as a child and you're now struggling to conceive, a semen analysis can help rule out a blockage.
does vasectomy reversal work
Vasectomy reversal is possible, but the success rate drops the longer you wait after the original procedure. According to data from the Cleveland Clinic cited in the article, after 10 years the chance of a successful reversal is around 50%. Vasectomy itself doesn't affect testosterone or sexual function, only whether sperm is present in the ejaculate.
can diabetes affect sperm quality
Yes, diabetes can affect sperm quality directly. A 2020 meta-analysis in Andrology found that men with diabetes had significantly lower sperm concentration and motility compared to healthy controls, with oxidative stress from high blood sugar appearing to damage sperm DNA. The article notes that improving blood sugar control through diet, exercise, and medication can reverse some of this damage.
what is the best test for male fertility
A semen analysis is described as the single best test for male fertility. It measures sperm count, motility, and morphology, and it's noted to be cheap and non-invasive. If you've been trying to conceive for 6 to 12 months without success, the article advises getting one and discussing the results with your doctor.

