A very strange incident
This is a good question, and perhaps the oddest and most challenging little detail about the crucifixion account in Matthew. Here is the passage:
Matthew 27: 51 And behold, the curtain of the temple was torn in two, from top to bottom. And the earth shook, and the rocks were split. 52 The tombs also were opened. And many bodies of the saints who had fallen asleep were raised, 53 and coming out of the tombs after his resurrection they went into the holy city and appeared to many. 54 When the centurion and those who were with him, keeping watch over Jesus, saw the earthquake and what took place, they were filled with awe and said, “Truly this was the Son of God!” (ESV)
Since this incident seems so odd, and since it is not confirmed by Mark and Luke, the first response to it is to check that it has a reliable manuscript tradition. Yet the passage is in all the earliest manuscripts of Matthew. Textually the oddity of the passage means that it would be more likely to be omitted than added. So that leads textual scholars unanimously to confirm it is part of the authentic text.
The second response is to wonder if it might be figurative or symbolic, a kind of prophetic gloss or comment by the author of the gospel. Again the problem is the physicality of the evidence “bodies”, “appeared to many”. This is language akin to Paul in 1 Corinthians 15:6 about the physicality and evidence of Christ’s own resurrection: “After that, he appeared to more than five hundred of the brothers and sisters at the same time, most of whom are still living, though some have fallen asleep.” However in this case a further strangeness is raised by mentioning that these raised people went into the “holy city” – and most importantly “after” the resurrection of Christ. Why after? Why would literal raised saints not hurry back to find their families immediately?
Having then not found any help in either a textual interpolation, nor a figurative meaning that then leaves us facing the text as it is. As this point anyone asking or answering about the verse really knows as much, or as little as the other. The following comments are to be taken as suggestions only.
If literal, then five points:
1. If it is literal, then this isn’t the only apparently random resurrection in the Bible. There is another apparently involuntary resurrection in 2 Kings:
2 Kings 13:21 And as a man was being buried, behold, a marauding band was seen and the man was thrown into the grave of Elisha, and as soon as the man touched the bones of Elisha, he revived and stood on his feet.
The logic of this incident isn’t explained, but one can see why with this story being recorded of Elisha’s grave, the author of Matthew would have precedent to record a larger incident of this kind happening at the death of Jesus. It is challenging to us in the present day when miracles with some logic in the narrative like the raising of Jairus’ daughter already strain our credibility, without the randomness of events like 2 Kings 13:21 and Matthew 27:52-54
2. If it is literal, then again it seems reasonable to assume Matthew is talking about some recently deceased saints, those with relatives still living, not the dead from centuries earlier. Simply because in the days before photographs and ID cards if a dead person from an earlier generation had been raised and entered the city he could not actually prove to anyone that he had been raised. The other raised in Old and New Testament were all immediately recognized by their relatives. A random person from an earlier generation entering the city and claiming to have been raised would simply have been dismissed as crazy.
3. If it is literal then the lack of further meetings or mentions of these “many” is odd, one would expect that if there were dozens that there would be some mention of them in the epistles. Paul giving a message “greet also so-and-so who was raised on the day our Lord died”, but on the other hand there is no further mention of Lazarus, Martha and Mary either and they were very close to Jesus. And again we have no evidence that these raised had any more relation with Jesus than the body thrown into Elisha’s grave had with Elisha. How many “many” indicates is anyone’s guess. But in the context of such an odd occurrence even five or six would be “many”.
4. Some have thought that “saints” might mean recently deceased Christian disciples, like Lazarus – though that raises the question why did not Jesus raise them at the time, like Lazarus? If saints here does mean some connection to Jesus, then how many of Jesus’ disciples had died during the three years of his ministry? A dozen? How many of those had been buried in Jerusalem, half? We don’t know, and thinking through the question of what happened to them afterwards doesn’t make the oddity of the original verse any less. It may be that those raised by this event were not public about it. Or again maybe the assumption that “saints” means disciples may be wrong. The “saints” may simply mean that Matthew using language of the time that all buried in Jerusalem – and in particular on the Mount of Olives – were by definition pious “saints” for having made arrangements to be buried in that most holy graveyard, and that beyond being buried in a “saintly” place, those raised had as little connection to Jesus as the 10 lepers of whom only 1 the Samaritan came back after being healed (Luke 17:11-19)
5. Although there is little information about this odd event there is also no evidence that bodies being raised here is in any different from any other raising. The man thrown in Elisha’s tomb, the other raisings in the Old Testament, the raisings performed by Jesus and afterwards in Acts by the Apostles – they all were raised as normal mortals, lived their remaining lives and eventually died of natural causes. None were raised as angels, zombies, spirits, nor elevated to heaven. We know that because 1 Corinthians 15:20-25 says so. Christ was firstborn from the dead, no other. Then when he comes “those that belong to him”.
If the passage is to be read as a figurative gloss, then that doesn’t remove the problem with mention of “bodies” and “appeared to many”. There are other “gory” incidents in the New Testament which might benefit from reading as idiom or figurative. An example of a verse which could benefit from a figurative reading The Acts 1:18 account of Judas’ “bowels spilling out”, in Acts : “With the payment he received for his wickedness, Judas bought a field; there he fell headlong, his body burst open and all his intestines spilled out.” (Acts 1:18). The usual use of “bowels” is the emotions, so the suggestion in that passage would be that it refers not to Judas’ rotten body falling from the tree, but Judas venting his spleen and throwing back the money – “So Judas threw the money into the temple and left” (Matthew 27:5), and that the “there” is not where he hanged himself but “there” where he bought a field. Possible, though not a common reading of Acts 1:18. Matthew 27:51-53 however is more than just a discussion of “there” and “bowels”, it is a long passage where there is little ambiguity.
Several readers have preferred to read it as an eschatalogical comment by Matthew, a gloss on why the temple veil was rent. Among them is this suggestion from Michael R. Licona:
“Given the presence of phenomenological language used in a symbolic manner in both Jewish and Roman literature related to a major event such as the death of an emperor or the end of a reigning king or even a kingdom, the presence of ambiguity in the relevant text of Ignatius, and that so very little can be known about Thallus’s comment on the darkness (including whether he was even referring to the darkness at the time of Jesus’ crucifixion or, if so, if he was merely speculating pertaining to a natural cause of the darkness claimed by the early Christians), it seems to me that an understanding of the language in Matthew 27:52–53 as “special effects” with eschatological Jewish texts and thought in mind is most plausible. There is further support for this interpretation. If the tombs opened and the saints being raised upon Jesus’ death was not strange enough, Matthew adds that they did not come out of their tombs until after Jesus’ resurrection. What were they doing between Friday afternoon and early Sunday morning? Were they standing in the now open doorways of their tombs and waiting? […] “It seems best to regard this difficult text in Matthew as a poetic device added to communicate that the Son of God had died and that impending judgment awaited Israel.” 
The above is not without problems, and there other alternative suggestions, which also present similar problems. However given Matthews’ midrash-like approach to some Old Testament prophecies and other eschatological passages a figurative possibility deserves exploration.
Reference : 1. Michael R. Licona, The Resurrection of Jesus: A New Historiographical Approach (Downers Grove, IL; Nottingham, England: IVP Academic; Apollos, 2010), 552-3