Wikipedia gives a long list of instances of the number 40 in Judaism and Christianity:
In the Hebrew Bible, forty is often used for time periods, forty days or forty years, which separate “two distinct epochs”.
Rain fell for “forty days and forty nights” during the Flood
Spies explored the land of Israel for “forty days.” (Numbers 13)
The Hebrew people lived in the Sinai desert for “forty years”. This period of years represents the time it takes for a new generation to arise.
Moses’ life is divided into three 40-year segments, separated by his fleeing from Egypt, and his return to lead his people out.
Several Jewish leaders and kings are said to have ruled for “forty years”, that is, a generation. (Examples: Eli, Saul, David, Solomon.)
Goliath challenged the Israelites twice a day for forty days before David defeated him.
Moses spent three consecutive periods of “forty days and forty nights” on Mount Sinai:
He went up on the seventh day of Sivan, after God gave the Torah to the Jewish people, in order to learn the Torah from God, and came down on the seventeenth day of Tammuz, when he saw the Jews worshiping the Golden Calf and broke the tablets
He went up on the eighteenth day of Tammuz to beg forgiveness for the people’s sin and came down without God’s atonement on the twenty-ninth day of Av
He went up on the first day of Elul and came down on the tenth day of Tishrei, the first Yom Kippur, with God’s atonement
A mikvah consists of 40 se’ah (approximately 200 gallons) of water
40 lashes is one of the punishments meted out by the Sanhedrin, though in actual practice only 39 lashes were administered.
One of the prerequisites for a man to study Kabbalah is that he is forty years old.
Christianity similarly uses forty to designate important time periods.
Before the temptation of Christ, Jesus fasted “Forty days and forty nights” in the Judean desert.
Forty days was the period from the resurrection of Jesus to the ascension of Jesus.
In modern Christian practice, Lent consists of the 40 days preceding Easter. In much of Western Christianity, Sundays are excluded from the count; in Eastern Christianity, Sundays are included.
The Forty Martyrs of Sebaste
Kirk Kilisse, “Forty Churches” (Σαράντα Εκκλησιές) in Eastern Thrace
I would add, there were also about forty years between the death and resurrection of Christ and the destruction of Jerusalem and of the Temple. In a rough way that is, certainly not to the day even if Christ was crucified in AD 30, which is far from certain. That’s about forty years of infancy for the Church.
Anyway, these numbers mutually relate to each other, the earlier ones prefiguring the later and the later referencing the earlier. But why forty? Is there something intrinsically meaningful about the number? Christian numerology has explored such topics starting with the number three as representing the Trinity and then looking for related significance in the other numbers of the Bible, but that kind of thing can easily get far-fetched. Also there is Wikipedia’s suggestion above that forty years represents the length of time it takes for a new generation to arise. If that is the case it would seem that the forty years in the desert may be the really practical instance of the number, with the other instances through history being providentially connected to it and to each other.
In any case the number something which knits together salvation history through time.