How did Elijah know that he was about to be taken by God?
How did Elisha know this was going to happen?
I could not find anything prior to 2 Kings 2:1 when Scripture states that Elijah was going to be taken up, and 2:9 when Elijah asks what he can do for Elisha before he is taken.
How did Elijah know that he was about to be taken by God?
Scripture does not say. The closest thing we get is this:
and Jehu the son of Nimshi you shall anoint king over Israel; and Elisha the son of Shaphat of Abel-meholah you shall anoint as prophet in your place. —1 Kings 19:16 NASB
God tells Elijah to anoint Elisha in his place, implying that it would not be long before Elijah was finished with his time as God's prophet. I found this commentary that mentions Elijah knew beforehand, but I could not find a Scriptural reference.
How did Elijah know he was going to be taken up to heaven?
The Scriptures are veiled in this subject matter. But one may be permitted to believe that God himself told Elijah that he was going to be taken up to heaven.
After all, did not God speak to his Prophet as he once spoke to Moses!
Jezebel, enraged that Elijah had ordered the deaths of her priests, threatens to kill Elijah. Later Elijah would prophesy about Jezebel's death, because of her sin. Elijah flees to Beersheba in Judah, continues alone into the wilderness, and finally sits down under a shrub, praying for death. He falls asleep under the tree; the angel of the Lord touches him and tells him to wake up and eat. When he awakens he finds bread and a jar of water. He eats, drinks, and goes back to sleep. The angel comes a second time and tells him to eat and drink because he has a long journey ahead of him.
Elijah travels for forty days and forty nights to Mount Horeb, where Moses had received the Ten Commandments. Elijah is the only person described in the Bible as returning to Horeb, after Moses and his generation had left Horeb several centuries before. He seeks shelter in a cave. God again speaks to Elijah: "What doest thou here, Elijah?". Elijah did not give a direct answer to the Lord's question but evades and equivocates, implying that the work the Lord had begun centuries earlier had now come to nothing, and that his own work was fruitless. Unlike Moses, who tried to defend Israel when they sinned with the golden calf, Elijah bitterly complains over the Israelites' unfaithfulness and says he is the "only one left". Up until this time Elijah has only the word of God to guide him, but now he is told to go outside the cave and "stand before the Lord." A terrible wind passes, but God is not in the wind. A great earthquake shakes the mountain, but God is not in the earthquake. Then a fire passes the mountain, but God is not in the fire. Then a "still small voice" comes to Elijah and asks again, "What doest thou here, Elijah?" Elijah again evades the question and his lament is unrevised, showing that he did not understand the importance of the divine revelation he had just witnessed. God then sends him out again, this time to Damascus to anoint Hazael as king of Aram, Jehu as king of Israel, and Elisha as his replacement.
From 1 Kings 19, we can see that God spoke to his Prophet!
8 And he arose, and did eat and drink, and went in the strength of that meat forty days and forty nights unto Horeb the mount of God.
9 And he came thither unto a cave, and lodged there; and, behold, the word of the Lord came to him, and he said unto him, What doest thou here, Elijah?
10 And he said, I have been very jealous for the Lord God of hosts: for the children of Israel have forsaken thy covenant, thrown down thine altars, and slain thy prophets with the sword; and I, even I only, am left; and they seek my life, to take it away.
11 And he said, Go forth, and stand upon the mount before the Lord. And, behold, the Lord passed by, and a great and strong wind rent the mountains, and brake in pieces the rocks before the Lord; but the Lord was not in the wind: and after the wind an earthquake; but the Lord was not in the earthquake:
12 And after the earthquake a fire; but the Lord was not in the fire: and after the fire a still small voice.
13 And it was so, when Elijah heard it, that he wrapped his face in his mantle, and went out, and stood in the entering in of the cave. And, behold, there came a voice unto him, and said, What doest thou here, Elijah?
14 And he said, I have been very jealous for the Lord God of hosts: because the children of Israel have forsaken thy covenant, thrown down thine altars, and slain thy prophets with the sword; and I, even I only, am left; and they seek my life, to take it away.
15 And the Lord said unto him, Go, return on thy way to the wilderness of Damascus: and when thou comest, anoint Hazael to be king over Syria.
Now, if we admit the possibility that God directly told the Prophet Elijah that he was going to be taken up to heaven, it is equally possible that Elijah told the others about just before his actual departure!
2 When the Lord was about to take Elijah up to heaven in a whirlwind, Elijah and Elisha were on their way from Gilgal. 2 Elijah said to Elisha, “Stay here; the Lord has sent me to Bethel.”
But Elisha said, “As surely as the Lord lives and as you live, I will not leave you.” So they went down to Bethel.
3 The company of the prophets at Bethel came out to Elisha and asked, “Do you know that the Lord is going to take your master from you today?”
“Yes, I know,” Elisha replied, “so be quiet.”
4 Then Elijah said to him, “Stay here, Elisha; the Lord has sent me to Jericho.”
And he replied, “As surely as the Lord lives and as you live, I will not leave you.” So they went to Jericho.
5 The company of the prophets at Jericho went up to Elisha and asked him, “Do you know that the Lord is going to take your master from you today?”
“Yes, I know,” he replied, “so be quiet.”
6 Then Elijah said to him, “Stay here; the Lord has sent me to the Jordan.”
And he replied, “As surely as the Lord lives and as you live, I will not leave you.” So the two of them walked on.
7 Fifty men from the company of the prophets went and stood at a distance, facing the place where Elijah and Elisha had stopped at the Jordan. 8 Elijah took his cloak, rolled it up and struck the water with it. The water divided to the right and to the left, and the two of them crossed over on dry ground.
9 When they had crossed, Elijah said to Elisha, “Tell me, what can I do for you before I am taken from you?”
“Let me inherit a double portion of your spirit,” Elisha replied.
10 “You have asked a difficult thing,” Elijah said, “yet if you see me when I am taken from you, it will be yours—otherwise, it will not.”
11 As they were walking along and talking together, suddenly a chariot of fire and horses of fire appeared and separated the two of them, and Elijah went up to heaven in a whirlwind. 12 Elisha saw this and cried out, “My father! My father! The chariots and horsemen of Israel!” And Elisha saw him no more. Then he took hold of his garment and tore it in two.
13 Elisha then picked up Elijah’s cloak that had fallen from him and went back and stood on the bank of the Jordan. 14 He took the cloak that had fallen from Elijah and struck the water with it. “Where now is the Lord, the God of Elijah?” he asked. When he struck the water, it divided to the right and to the left, and he crossed over.
15 The company of the prophets from Jericho, who were watching, said, “The spirit of Elijah is resting on Elisha.” And they went to meet him and bowed to the ground before him. 16 “Look,” they said, “we your servants have fifty able men. Let them go and look for your master. Perhaps the Spirit of the Lord has picked him up and set him down on some mountain or in some valley.”
“No,” Elisha replied, “do not send them.”
17 But they persisted until he was too embarrassed to refuse. So he said, “Send them.” And they sent fifty men, who searched for three days but did not find him. 18 When they returned to Elisha, who was staying in Jericho, he said to them, “Didn’t I tell you not to go?”
This is a prophetic event, a type and a foreshadowing.
Elijah is Christ and Elisha the disciples.
Do the disciples see Christ caught up to heaven? Yes.
They also get the double portion of the first born just like Elisha gets the mantle and the double portion from his master.
Does Elijah know that is going to be taken up to heaven? Yes.
Christ knows he was going to be taken to heaven and so does Elijah.