Dick York was very attracted to Elizabeth Montgomery and he let her know it - despite the fact they were both married to other people at the time. York was prescribed narcotics to deal with his chronic back pain; over time he became more dependent on the narcotics and began to increase his dosage. The narcotics lessened York's inhibitions and his behavior toward Elizabeth Montgomery became less professional and more inappropriate.
Elizabeth Montgomery's discomfort with Dick York along with the departure of Danny Arnold as writer/producer and the ABC executives' request for broader comedy all combined to change the tone of Bewitched from a romantic comedy to one that stressed the fantasy/magical elements of the plot. Though William Froug was credited as producer in season three, William Asher was producer in all but title by that time.
Though it is often repeated that Dick York's back pain led to his increasing absences and eventual departure from Bewitched, his dependence on narcotics played a larger role. In January of 1969 York suffered seizures due to an overdose of narcotics which required hospitalization. While in the hospital, York spoke with William Asher and the two decided that York would not be returning to the series. A lot of interesting stories have circulated since York's departure about the various scenarios the producers considered to explain his absence but William Asher made up his mind very quickly how he wanted to handle the situation: within days of his conversation with York, he reached out to Dick Sargent and told him to be sure to be available when filming of the sixth season of Bewitched began that Summer. Asher told Sargent that, provided ABC and Screen Gems agreed, he would replace Dick York as Darrin Stephens.