In medieval times, why did people choose to study, or work, in the Church?
The reasons the Roman Catholic Church was so important in the Middle Ages are both practical and spiritual. On a spiritual level, it was the established church of western Europe, and because of the ways in which clerical and national power were intertwined, anyone not a member of the church was considered a traitor as well as heretic. The reasons for church membership, though, were far from cynical. Many people had deep spiritual beliefs and vocations, leading them to devote their lives to the service of God within the church.
On a practical level, many of the functions that in modern society are handled by governments were handled by the church in the middle ages. For example, registration of births, deaths, and marriages was handled on the parish level, as was most aid to the poor. Much of what now is done by civil servants was handled by the church bureaucracy. It was not until the nineteenth century that these functions were taken over by the state, resulting in the civil service expanding and church bureaucracy shrinking. Education was also almost the sole province of the church. If you wanted to learn to read or write, you attended a school run by the church. The church was also one of the largest employers in Europe, and as a large established institution, was a reliable one -- you could be sure it wasn't about to disappear or not pay your salary.
Finally, for women, especially of the middle and upper classes, the convents were the only real alternative to marriage, and one of the few places where women could pursue an education and have genuine control over their own lives, rather than being subordinate to fathers and husbands.