Literally: it is a Proverb "The mother of Mencius changed her home/abode three times to better her son's education (to avoid bad influence on her son)." Metaphor: A wise mother would do everything for the healthy growth of her children.
Definitions (Wiktionary)
phrase, idiomatic, of parents
to be concerned with their children's growth