Saint Joseph is the compass of the Holy Family. The angel of the Lord appears to him in a dream and directs him to fly with his family to Egypt, and again later, revealing to him the time of the return from Egypt. And, on the return, Saint Joseph weighs the new political situation and decides where to settle the family: Nazareth.
God did all of that through the head of the Holy Family: Saint Joseph. His adoptive Son was perfect as was his wife (the Immaculate Conception and ever Virgin Mary) and yet both needed to obediently follow Saint Joseph for, as the husband and putative father, he was chosen to lead them. (cf. Matthew 2:13-23 [the Gospel for today's Mass: The Feast of the Holy Family])
Every husband and every father is called by God to lead his family under God; and his wife and children should follow him in everything except sin; for God himself has placed him as the family compass, as is so clear in the Holy Family.