What was a main purpose of monasteries built by the Catholic Church?

For the most part, monasteries were not built by the Catholic Church but by individual monks or Orders. All the Catholic Church did was approve of their rule of life and, especially in the case of women's monasteries, established canonical enclosure giving them grills to protect them from the outside world.