Gregory Pincus with the help of financing from Margaret Sanger and others started his contraceptive research. Pincus found Djerassi who helped to create progestin an synthesis progesterone which did work as a contraceptive when taken orally.
Progestin was first approved by the FDA for for menstrual disorders. The drug company (Searle)quickly applied to have it's use extended to include contraceptive, which it was in 1960.
So to answer your question. Djerassi wasn't looking to find a contraceptive, but his financial backers wanted exactly that. Not exactly what I would call an accident.
I think that birth control has changed behavior of people.
Sex and marriage and children all used to be part of a package deal. Sex has now been separated from reproduction, reproduction has been separated from marriage, and overall, most people have smaller families than in the past.
Given the morality of the old days, the researchers may have thought that only married couples would use the pill to plan the timing or number of children they had. They might not have expected that tens of millions of single girls and women would take the pill. They probably didn’t expect that millions of both men and women would rely on the pill to prevent consequences of being sexually active singles, with no thought of marriage.