Which drugs do harm the sperm quality/production?
Anabolic-androgenic steroids are substitutes of naturally occurring masculine hormones (testosterone). Used in high dosages or long-term (in general, more than 8-10 weeks) they can affect sperm cell production. These alterations persist, in general, several weeks.
Cannabis has also been linked to alterations in masculine hormone production, although it has only been proved in animal experimentation and not in humans. It is very unlikely that common recreational cannabis patterns of use in humans produce significant effects in reproductory system.