In a recent study, two common drugs used to treat both hair loss and prostate problems were shown to cause long-term erectile dysfunction (ED) in young men. The younger the men, the bigger the risk. 
The medications in question are known generically as finasteride and dutasteride and are sold under the brand names Propecia, Proscar, and Avodart.
In the study, men under age 42 who took one of these drugs for more than 205 days were nearly 5 times more likely to have long-term problems achieving an erection compared to men who took the drugs for less than 205 days, the researchers wrote in PeerJ.
Dr. Steven Belknap, a research assistant professor of dermatology at Northwestern University Feinberg School of Medicine in Chicago, said in a statement:
“Our study shows [that] men who take finasteride or dutasteride can get persistent erectile dysfunction, in which they will not be able to have normal erections for months or years after stopping finasteride or dutasteride.” 
Read: 9 Natural Remedies for Hair Loss and Hair Thinning
Both drugs work by blocking the conversion of testosterone into 5-alpha-dihydrotestosterone (DHT), the hormone’s more active form. DHT can lead to male pattern baldness because it dampens another chemical signal in the body that spurs hair-cell growth.
For the study, researchers looked at data on over 12,000 men in the Northwestern Medicine Enterprise Data Warehouse, a database of medical records for patients treated at Northwestern Medicine. The team focused on men ages 16 to 89 who had been prescribed one of the drugs at least once between 1992 and 2013.
Researchers looked at both the dosages of the medications the men were prescribed as well as the length of time the men took the drugs. In addition, they looked for any diagnoses of sexual dysfunction, including low libido, ED, and persistent ED.
The investigators found that 1.4% (167) of the men who took either finasteride or dutasteride developed long-term ED. That’s a pretty small risk, but the condition lasted a median of 3.5 years after they stopped taking the medications. About 4.5% of the men developed shorter-term ED.
Overall, the risk of ED was found to be higher in men who took either drug for long periods. In young men, longer exposure to finasteride posed a greater risk of persistent ED than all other assessed risk factors. 
Read: Saw Palmetto Shown to Shrink an Enlarged Prostate
The latest findings may have an impact on prescribing information for the medications. In 2012, the FDA changed the labels on Propecia and Proscar to reflect the reports of long-term sexual difficulties. According to Belknap, those risks aren’t always presented to patients the drugs are prescribed to.
The drugs’ current prescribing information states that the risks are not worsened by taking the medications for longer periods, and that stopping the drugs clears the problem up. Nearly 1,300 finasteride-related lawsuits suggest otherwise. The researchers noted:
“Some reports describe men with symptoms beginning within days of initiating finasteride and persisting for years after stopping finasteride.” 
 Live Science
 NBC News