Monasticism is not strictly a Christian phenomenon. Every big religion of ancient and modern times had some form of a monastic movement.
The original roots of monasticism are lost in history. But there are several causes and influences which may have contributed to a certain extent.
One cause driving people to embrace the monastic lifestyle, is simply an internal strife of people for purity, freedom from the temptations of a corrupt world. That is the basic principle as to why people choose the monastic lifestyle. They understand the world is a corrupt place, there's something wrong with it, and they just want to get away from it.
A strong ascetic tendency of human nature, along with teachings of various philosophical and religious systems spurred renewed waves of monastic movements from time to time.
India is thought by some to be the birthplace of monasticism. Historic writings from the region dating as far back as 2400 B.C. give us many legends of monks and ascetic orders.
Hindoo ascetic was known to devise very harsh ways of self-torture. They would bury themselves with just their nose left out of the ground, walk in iron collars, clenched their fists until their nails grew into their palms, and kept their head turned in one direction until they were no longer able to turn it back.
Buddhist ascetics were less cruel to themselves. But the same desire to save themselves and themselves only was the common desire.
Pythagoras, born around 500 B.C., established a religious brotherhood where he tried to realize the ideal of friendship. Many historians argue that his philosophy had a strong influence on monasticism in Egypt and Palestine after the time of Christ.
Teachings of Plato may have contributed to the monastic ideology. His idea that everything in heaven is good, and everything on Earth is evil, was the same idea that led many people to torture their bodies as the greatest evil.
Closer to the coming of Christ, there was a Jewish sect, Essenes, with strong resemblences to Christian monasticism. Historian Philo says, groups similar to the Essenes were present in different parts of the world, with greatest concentration in Egypt.
In his letter to the Colossians, apostle Paul, undoubtedly referred to a monastic school which called to despise the body and abstain from meats. A false asceticism, gathering inspiration from pagan philosophy, was rapidly spreading among Christians even in the early church.
The teaching of Gnostics, became prominent at the closing of the apostolic age. The Gnostics taught complete subordination of the body through harsh treatments of self. They claimed to have access to special knowledge unatainable to ordinary Christians.
Large scale monastic movements in Christianity began as early as the middle of the third century. Those movements may be the evidence that the church was very much secularized as early as the middle of the third century, since many people apparently could not satisfy their spiritual longings inside the church in the cities, and went into the wilderness.
Wishart, Alfred Wesley. A Short History of Monks and Monasteries,. Trenton, NJ: A. Brandt, 1900. Print.
Image source: http://fatherboniface.org/catholic.html