A "nunnery" is another word for a convent. In Hamlet, the title character uses the quote "Get thee to a nunnery" as a way of telling Ophelia, a woman he had a relationship with, that she should never marry or have children.