There are two interpretations given for the fast being forty days and forty nights:
First, as the administration of the old covenant was accompanied by forty days of fasting (Exodus 34:28, Deuteronomy 9:9), and as Elijah’s journey of forty days to Sinai was reminiscent of Moses (1 Kings 19:8), Jesus initiated the new covenant with a forty-day fast.
Second, the forty-day fast matches the forty days between Jesus’ resurrection and ascension, as well as the forty years that Israel wandered in the wilderness (but without being deprived of food). While Israel failed to resist temptation (1 Kings 19:10, 1 Corinthians 10:6–13), Christ, having come out of Egypt (Matthew 2:15) as Israel did, relies on his Father in prayer (John 4:23), unlike Israel.
Interpretation 1:
Jesus’ action is prefigured by Moses and Elijah before him (Exodus 34:28, Deuteronomy 9:9, 1 Kings 19:8). Just as the administration of the old covenant was accompanied by forty days of fasting (and as Elijah’s journey of forty days to Sinai was reminiscent of Moses), Jesus initiated the new covenant with a fast.1
Interpretation 2:
The forty days of fasting corresponds to the forty days between Jesus’ resurrection and ascension. This period also reminds of the forty years that Israel wandered in the wilderness, during which God miraculously maintained without earthly bread. Inasmuch as this time period was one of temptation for the Israelites (see 1 Kings 19:10 and 1 Corinthians 10:6–13), the Redeemer here follows the same path as the people of the covenant (Matthew 2:15). Christ undoubtedly spent this time in prayer, meditating upon his work as Mediator and upon God’s Word (John 4:23).2
2 Après avoir jeûné quarante jours et quarante nuits, il eut faim.