Yes, it was prophesied that the Messiah was to be a craftsman1 (carpenter) in Zechariah 1:20:
NIV Zechariah 1:
18Then I looked up, and there before me were four horns. 19I asked the
angel who was speaking to me, “What are these?” He answered me, “These
are the horns that scattered Judah, Israel and Jerusalem.” 20Then
the Lord showed me four craftsmen. 21I asked, “What are these coming
to do?” He answered, “These are the horns that scattered Judah so
that no one could raise their head, but the craftsmen have come to
terrify them and throw down these horns of the nations who lifted up
their horns against the land of Judah to scatter its people.”
According to the Talmud, (Sukka 52b) the earliest theological writings we have from Rabbis and Jewish scholarship, the 4 craftsmen2 were The Messiah, son of David; the Messiah, son of Joseph, Elijah and Melchizedek, the high priest.
§ Apropos the end of days, the Gemara cites another verse and
interprets it homiletically. It is stated: “The Lord then showed me
four craftsmen” (Zechariah 2:3). Who are these four craftsmen? Rav
Ḥana bar Bizna said that Rabbi Shimon Ḥasida said: They are Messiah
ben David, Messiah ben Yosef, Elijah, and the righteous High Priest,
who will serve in the Messianic era. Rav Sheshet raised an objection:
If so, if that is the identity of the four craftsmen, then that which
is written in the previous verse: “And he said to me: These are the
horns that scattered Judea” (Zechariah 2:2), is difficult; these four
in the first verse are coming for their enemies, and are not
redeemers.
Rav Ḥana said to Rav Sheshet: Go to the end of the verse: “These then
are come to frighten them, to cast down the horns of the nations,
which lifted up their horn against the land of Judah to scatter it.”
This indicates that the horns refer to the nations that exiled the
Jewish people and that the four craftsmen will hurl those horns aside.
Rav Sheshet said to him: Why should I disagree with Rav Ḥana in
matters of aggada, where he is more expert than I, and I cannot
prevail?
It is likely that most of the beliefs outlined in the Talmud were held as oral tradition during Jesus times, the the writings of the Talmud are believed to record the teachings of several rabbinical schools of thought
as they had been passed down from teacher to student for many generations.
It is for this reason (among many others) that the authors of the Gospels provided detailed genealogies, that Jesus was often placed in the position of Elijah in literary parallels and frequently mistaken for Elijah (though John the Baptist was also thought to be Elijah) and in Hebrews 7, the author makes the arguement that Jesus was the High Priest "in the order of Melchizedek". All of these culminate to fulfill the prophecy of Zechariah 1:20, but are dependant on Jesus being a craftsman.
In addition to this, this also helps to serve to fulfill the prophecy of Zechariah 9:9:
Rejoice greatly, O daughter of Zion! Shout in triumph, O daughter of Jerusalem! Behold, your king is coming to you; He is just and endowed with salvation, Humble, and mounted on a donkey, Even on a colt, the foal of a donkey.
This is because craftsman had an extremely low social status. By having this trade, Jesus was able to be of humble origins, thus partially fulfilling this prophecy as well.
Finally, being a craftsman serves the narrative that Jesus was unexpected. Instead of coming and claiming victory over the Roman occupiers as was expected, Jesus instead dismantled the highly stratified Jewish socio-political honor-shame class system. Time after time, the Gospels depict Jesus as being more highly regarded than the Jewish and Roman elites: a Centurion seeks help from Jesus, Jesus frequently proves his intellectual superiority over the San Hedron, the Pharisees, the Sadducees and Experts of the Law. But Jesus did not come from a class of elites, but instead was a lowly craftsmen. This turns the system on it's head.
1 Neither the Hebrew nor the Greek can be taken to explicitly mean carpenter. חָרָשׁ which appears in Zechariah 1:20 (translated carpenter) merely means craftsman. It is used to describe masons, engravers and other types of stoneworkers as well as carpenters. The same is technically true of the Greek τέκτων, However, τέκτων is frequently contrasted in Greek writings with stone-worker or mason (λιθολόγος, λαξευτής) even though it could encompass these trades. So, λιθολόγος and λαξευτής can be thought of as types of τέκτων or a specialty within the field of τέκτων. Because there were Greek words for λιθολόγος and λαξευτής however, unless context dictated otherwise, it would be assumed this referred to carpentry as the more specific term would be otherwise used. That being said, there is a strong case based on the types of homes built near Nazareth, that there would have been little woodworking available and Jesus and Joseph likely worked with stone. It seems to me however, that Jesus might have also been familiar with both woodworking and stonecutting, and I see no reason to pigeonhole him into one expertise. I think there is a lot of literary value in not just the Ark of the Covenant and Noah's ark being salvific and Jesus being a skilled carpenter, but also in Jesus being a stoneworker and the rock upon which Peter built the church, the one who could move the stone of his tomb and the one who would destroy the foundations of the temple and build it up again.
2 It occurs to me that we have 4 Gospels, each depicting a different aspect of The Craftsman and Messiah, Jesus. These don't seem to quite correspond to the 4 craftsman as they were understood by the Talmud, but this is an interesting coincidence.