they are used for treating prostrate enlargement as well as hair loss in men, among other things..
https://en.wikipedia.org/wiki/Finasteride https://en.wikipedia.org/wiki/Dutasteride
But I don't think that this side-effect was unknown. ED / sexual dysfunction is a documented side effect for both the drugs in a significant percentage of the patient population.