Bryan is right--finasteride was CLEARLY designed to treat male pattern baldness. I wrote about this 5 years ago on this site, but I'm not sure the record is available.
To reiterate, the evidence is the following: Merck published a paper in the middle of May or June 1988 concerning the use of a precusor drug (4-MA; a 5-alpha reductase inhibitor) in preventing male pattern baldness in macaques (animal model for male pattern baldness in humans). The study was 20 months in length. As it takes about 6 months to 1 year after a paper is submitted until it gets published and Merck had to spend some time planning and writing the paper (a few months to a year), the scientists at Merck were clearly thinking about the use of 5-alpha reductase inhibitors in the early to mid 1980s. As finasteride was patented in 1984 (or about this time) and approved for used in BPH in 1992, its use in humans would not have occured in clinical trials until the late 1980's. In other words, the potential utility of 5-alpha reductase inhibitors in male pattern baldness was being discussed at Merck before a human ever took finasteride.
Finasteride was origninally designed to treat both BPH and male pattern baldness, and the proof is in the literature; it was NOT found by 'accident' to be of value in male pattern baldness in patients originally treated for BPH. In the landmark paper on inherited 5-alpha reductase deficency, Imperato-McGinley et al (Imperato-McGinley et al., Steroid 5-alpha reductase deficency in man: an inherited form of male pseudohermaphroditism, Science, 186, 1213-1215, 1974) noted that men with this disease don't develop prostate problems and don't lose their hair. You can see the Merck researchers seeing this and thinking they can make more money if they design a single drug to treat both conditions, which is what they did. In their paper from 1987 (Rittmaster et al, The Effects of N,N-Dimethyl-4-Methyl-3-Oxo-4-Aza-5- alpha Androstane- 17beta- Carboxanide, a 5-alpha Reductase Inhibitor and Antiandrogen, on the Development of Baldness in the Stumptail Macaque. J. Clin. Endo. Met., 65, 188-193), they studied the value of using a precursor to finasteride (abbreviated 4-MA) in treating male pattern baldness in the macaque, a model for human male pattern baldness. How does this prove that finasteride was also designed to treat male pattern baldness? The study was submitted in January, 1987 and was a 27-month study of the macaques. Thus at the very latest Merck researchers were thinking about the use of a 5-alpha reductase inhibitor in male pattern baldness in late 1984. This doesn't account for the planning done to create the study, demonstrating that Merck was thinking about the use of a 5-alpha Reductase Inhibitor in male pattern baldness from the early to mid 1980's, long before finasteride was ever synthesized.