Originally a solemn commitment declared publicly to do certain work, especially in response to a calling. “Professors” would hone their talents with study. Institutions evolved to ensure those earned a living, and later to protect that livelihood, especially from competitions and other outsiders.
Over time, this evolved into simply a paid occupation, especially one that involves prolonged training and formal qualifications.
Etymology: from L. professiō from verb profiteri “declare publicly”