Dear user, an infection in the testes can cause an infection in the semen. It could be orchitis, epididymo- orchitis or epididymitis. These infections can be caused by a urinary tract infection or also by a sexually transmitted infection. With proper medication, the infection will resolve in due course of the infection. The time for resolving depends only on the extent of the infection. You can consult me for more doubts regarding this online by clicking on my photo and booking an appointment however, if you found my answer helpful, please leave a positive feedback as it helps me with my practice. Thank you.