God picked Joseph to be Jesus’ adopted father. Joseph came from the house of David, which would fulfill the many prophecies about the Messiah coming from the house of Judah. Jesus would need an earthly father to care for Him, to love and protect Him, and to teach Him. In the same way that Jesus was the adopted son of Joseph, we too are the adopted children of God through faith.
Reference from "Joseph the Father" by Pastor Edward Naumann.