Jesus has been "going up to Jerusalem" ever since He left Galilee for the last time (cf. 19:1). In other words, He is heading to Jerusalem but not in a hurried fashion. He will get there at the proper time.
The disciples are both amazed and fearful because of Jesus' intention to go to Jerusalem (cf. Mark 10:32). They are fearful because they are well aware of the danger involved in doing such and amazed that He was so determined to go there (cf. John 11:7-16,47-57). Also, Jesus is not speaking reassuring words regarding His future.
"Then He took the twelve aside again and began to tell them the things that would happen to Him." Jesus did not make the following declaration to all of His followers but only His apostles. He evidently believed that speaking the message publicly would not have been beneficial at that time.
"All things that are written by the prophets concerning the Son of Man will be accomplished" (Luke 18:31; e.g., Isa. 53; Psa. 22; etc). Jesus had prophesied of His death before, but never with as much detail as is found in Matthew 20:18,19.
Consider the seven aspects of this prophecy--Jesus would be:
Certainly this final detail was told so the apostles would not be crushed by the announcement and fulfillment of His impending death.
Jesus wanted His apostles to know that these events did not surprise Him; He knew of them long before they occurred. By telling them beforehand, they would be even more convinced of His deity once the events were fulfilled precisely. Certainly this detailed prophecy is one of the most remarkable predictions recorded in God's word.
"But they understood none of these things; this saying was hidden from them, and they did not know the things which were spoken" (Luke 18:34). The apostles heard the facts spoken but did not comprehend them. The reason why the meaning was hidden from them was probably because they continued to cling to their seriously flawed physical conception of the Messianic kingdom. It wasn't until later that the full significance of Jesus' words "sank in" (cf. Luke 24:44,45; John 12:16).