In my readings regarding Sor Juana Ines de la Cruz, it seems that becoming a nun was a choice she preferred to make, rather than being married (in which she had no interest). She was illegitimate and came from a relatively poor ("unconnected") family, and because learning was her passion, the convent would have provided her with a socially acceptable way to continue studying and writing.
In 1667, given what she called her “total disinclination to marriage” and her wish “to have no fixed occupation which might curtail my freedom to study,” Sor...Juana began her life as a nun with a brief stay in the order of the Discalced Carmelites. She moved in 1669 to the more lenient Convent of Santa Paula of the Hieronymite order in Mexico City, and there she took her vows. Sor Juana remained cloistered in the Convent of Santa Paula for the rest of her life.
Sor Juana is considered something of a prodigy in her young years, and later, a strong feminist voice for women. Some sources report that her writing, "Respuesta a Sor Filotea" "has been hailed as the first feminist manifesto." For most of her time there, convent life suited her and allowed her to write as she saw fit. It was not until the later years of her life that she lost the patrons who protected her "freedom of speech and opinion" (in 1688), and was forced to live a "quieter" life, unable to freely write as she felt moved to.
Additional source: http://www.biography.com/articles/Sor-Juana-Inés-de-la-Cruz-38178