I don't think that it was a rule the way it so often was for the second son to go into the clergy or the military. But sometimes pious parents would dedicate one child for religious life from birth or in response to answered prayers for something else. The child's feelings on the subject were not taken into consideration.
This and they simply often had no other choice. Either live as a spinster in a palace where nobody wants you or enter a convent (where you can learn and study and do something good).
This was the case f. e. of two daughters of Empress Maria Theresia.