The impetus towards establishment of universities began in the Carolingian Renaissance. While Latin was the official language of the church, it was not the native language of the rising northern kingdoms. This meant that Francish priests were not native speakers of Latin (and often barely literate) and thus might misread elements of the liturgy. This raised a worry that the sacraments might not be efficacious. For one well known example, rather than baptizing someone "in nomine Patris [father] et Filii [son] et Spiritus Sancti", one barbarian priest substituted "patria" (nation or fatherland); there was some doubt as to whether such a baptism would be efficacious or canonical. Charlemagne therefore invited Alcuin to his court to provide instruction. The later development of the medieval university included a substantial theological rationale as it served as training for the clergy and acted as a mode of dissemination of orthodoxy and a laboratory for advanced theological thought.
The second factor influencing the development of the university was the great explosion of knowledge in the twelfth century, due in large part to contact with Muslims in Spain and Byzantines via trade with Venice and other mercantile western cities. This lead to a rebirth of classical medical knowledge, rhetoric, and philosophy (in particular, Aristotle, who was applied to theology by the Scholastics), all of which were taught in the three major faculties of theology, medicine, and law.
Finally, many of the university-trained priests were being prepared for careers in the church bureaucracy. Next, the universities trained teachers for the monastic and cathedral schools. Skills used by merchants tended to be taught by private teachers outside the university system or learned from imitating cartularies.
There are at least two factors that led to the growth of universities in the Middle Ages. One of these factors was the growing wealth that various areas of Europe were coming to enjoy in the High Middle Ages. The other factor was the growing need for professionals to take part in governing the state and the Church.
Although we think of the Middle Ages as a time of poverty, this is not true of that entire time period. By the High Middle Ages, Europe was becoming more prosperous. This meant that there came to be more cathedrals, each with its own school. Without wealth, towns could not have supported cathedrals and cathedrals could not have supported schools. These schools eventually turned into universities in some cases.
One reason why they did turn into universities was that the Church and the secular governments were becoming more organized. They needed educated people to serve in positions of authority. The universities were a way of training the people who would fill these positions.
Thus, the rise of the university showed that Europe was progressing in some ways to be a richer and more organized society.