A monk is not "married" to his monastery in any sense at all, so there is nothing to be annulled. If a monk wishes to leave the monastery, he can ask for an "indult of exclaustration" (canon 686 section 1), which can be granted by either the bishop or the pope, depending on what kind of religious institute ("order") the monk is in.
Once the monk is granted this indult, he is " considered freed from the obligations which cannot be reconciled with the new condition of his or her life" (canon 687), including the perpetual vows of celibacy and of poverty (is that its one of the vows of the institute he was a member of). If the former monk marries at this point, his responsibility is solely to his wife and his family. There is no question of any part of his inheritance going to the monastery unless he specifically wills it.