Doctorates go back to the 1100s. Medical doctorates go back to 1780.
The term "doctorate" derives from the Latin docere meaning "to teach". The doctorate (Latin: doctor, "teacher," from doctum, "[that which is] taught," past participle of (docere), "to teach") appeared in medieval Europe as a license to teach Latin: (licentia docendi) at a medieval university. Its roots can be traced to the early church when the term "doctor" referred to the Apostles, church fathers, and other Christian authorities who taught and interpreted the Bible.
The right to grant a (licentia docendi) was originally reserved to the Catholic church, which required the applicant to pass a test, to take an oath of allegiance and pay a fee. The Third Council of the Lateran of 1179 guaranteed the access—at that time largely free of charge—of all able applicants. Applicants were tested for aptitude. This right remained a bone of contention between the church authorities and universities that were slowly distancing themselves from the Church. The right was granted by the pope to the University of Paris in 1213 where it became a universal license to teach (licentia ubiquie docendi). However, while the licentia continued to hold a higher prestige than the bachelor's degree (Baccalaureus), it was ultimately reduced to an intermediate step to the Magister and doctorate, both of which now became the exclusive teaching qualification.
University doctoral training was a form of apprenticeship to a guild. The traditional term of study before new teachers were admitted to the guild of "Masters of Arts" was seven years, matching the apprenticeship term for other occupations. Originally the terms "master" and "doctor" were synonymous, but over time the doctorate came to be regarded as a higher qualification than the master's degree. Makdisi's revised hypothesis that the doctorate originated in the Islamic (Ijazah), a reversal of his earlier view that saw both systems as of "the most fundamental difference", was rejected by Huff as unsubstantiated.