It’s possible. For men testosterone treatment, anabolic steroids, narcotic painkillers, SSRI antidepressants like sertraline or venlafaxine, sulfasalazine, smoking, heavy alcohol, and marijuana can all affect fertility. Sperm numbers and quality are relatively easy to measure compared to female fertility.
In women we know less about the long-term effects of medicines on fertility or ovarian reserve (egg supply). Medications that raise prolactin hormone levels can affect ovulation and reduce fertility – chlorpromazine, prochlorperazine, haloperidol, risperidone, metoclopramide, methyldopa, cimetidine, some older antidepressants like amitriptyline, SSRI antidepressants like sertraline or fluoxetine, and many others. Immunosuppressants such as cyclophosphamide can cause reduced ovarian reserve. Drugs that may affect the ovaries but have not been well studied long-term include newer immunosuppressants like tacrolimus and sirolimus, and antirheumatic drugs like hydroxychloroquine or methotrexate.