TL:DR; Sleep does not cause temptation, prayer prevents it.
How does sleep put the apostles into temptation?
It doesn't. The most likely source of your question is that the cause and effect you attribute is a misunderstanding of the Scripture. On that scene in Matthew we can choose four insights of many, with sources and expanded discussion below. In short, the point being made is that it is prayer that will protect you against temptation, rather than that sleep causes temptation.
- Origen: Finding them thus sleeping, He rouses them with a word to hearken, and commands them to watch; "Watch and pray, that ye enter not into temptation;" that first we should watch, and so watching pray. He watches who does good works, and is careful that He does not run into any dark doctrine, for so the prayer of the watchful is heard.
- St Jerome: It is impossible that the human mind should not be tempted, therefore He says not "Watch and pray" that ye be not tempted, but "that ye enter not into temptation," that is, that temptation vanquish you not.
- St Hilary: And why He thus encouraged them to pray that they might not enter into temptation, He adds, "For the spirit indeed is willing, but the flesh is weak;" this He says not of Himself, but addresses them.
- Origen: These then He would have watch and pray that they should not enter into temptation, for the more spiritual any one may be, the more careful should he be that his goodness should not suffer a great fall.
Detailed discussion.
What's available for the Catholic perspective on this?
In footnote 26 of the English version of Scripture hosted at the Vatican web site, you find an explanation of that snippet of verse. Note that the translation uses "undergo the test" rather than "temptation."
41 Watch and pray that you may not undergo the test. 26
The footnote:
26 [41] Undergo the test: see the note on ⇒ Matthew 6:13. In that
verse "the final test" translates the same Greek word as is here
translated the test, and these are the only instances of the use of
that word in Matthew. It is possible that the passion of Jesus is
seen here as an anticipation of the great tribulation that will
precede the parousia (see the notes on ⇒ Matthew 24:8; ⇒ 24:21) to
which ⇒ Matthew 6:13 refers, and that just as Jesus prays to be
delivered from death (⇒ Matthew 26:39), so he exhorts the disciples
to pray that they will not have to undergo the great test that his
passion would be for them. {emphasis mine} Some scholars, however,
understand not undergo (literally, "not enter") the test as meaning
not that the disciples may be spared the test but that they may not
yield to the temptation of falling away from Jesus because of his
passion even though they will have to endure it.
From this explanation we find that the understanding of that line in scripture is nuanced, but it does not present sleeping as the trigger to temptation.
The context.
It is good to consider a verse in the greater context of the narrative. Lines 40 and 41 together address his desire that they keep the watch with him (you have to stay awake to keep watch) and that they pray that they (his disciples) do not have to undergo the test. (See the note above). That more complete reading of the scene does not link sleep to temptation, but links prayer as a way to ward off, or be protected from, temptation. (Cf also the Lord's Prayer).
36 Then Jesus came with them to a place called Gethsemane, and he
said to his disciples, "Sit here while I go over there and pray." 37
He took along Peter and the two sons of Zebedee, and began to feel
sorrow and distress. 38 Then he said to them, "My soul is sorrowful
even to death. Remain here and keep watch with me." 39 He advanced
a little and fell prostrate in prayer, saying, "My Father, if it is
possible, let this cup pass from me; yet, not as I will, but as you
will." 40 When he returned to his disciples he found them asleep.
He said to Peter, "So you could not keep watch with me for one hour?
41 Watch and pray that you may not undergo the test. 26
The spirit is willing, but the flesh is weak." 42 Withdrawing a
second time, he prayed again, "My Father, if it is not possible that
this cup pass without my drinking it, your will be done!" 43 Then he
returned once more and found them asleep, for they could not keep
their eyes open. 44 He left them and withdrew again and prayed a
third time, saying the same thing again. 45 Then he returned to
his disciples and said to them, "Are you still sleeping and taking
your rest? Behold, the hour is at hand when the Son of Man is to be
handed over to sinners. 46 Get up, let us go. Look, my betrayer is
at hand."
What about a more traditional look?
An older translation examining scripture uses the term "temptation". That rendering is then addressed in Saint Thomas Aquinas' Catena Aurea. The commentaries of previous theologians are presented and compared on that scene in Matthew.
- And he went a little farther, and fell on his face, and prayed, saying, "O my Father, if it be possible, let this cup pass from me:
nevertheless not as I will, but as thou wilt." 40. And he cometh unto
the disciples, and findeth them asleep, and saith unto Peter, "What,
could ye not watch with me one hour? 41. Watch and pray, that ye
enter not into temptation: the spirit indeed is willing, but the flesh
is weak." 42. He went away again the second time, and prayed,
saying, "O my Father, if this cup may not pass away from me, except I
drink it, thy will be done." 43. And he came and found them asleep
again for their eyes were heavy. [p. 909] 44. And he left them, and
went away again, and prayed the third time, saying the same words.
St Thomas Aquinas lists some of the commentaries from theologians who preceded him.
Origen: And though Jesus went but a "little forward," they could not
watch one hour in His absence; let us therefore pray that Jesus may
never depart even a little from us.
Chrysostum: He "finds them sleeping," both because it was a late
hour of the night, and their eyes were heavy with sorrow.
Hilary: When then He returned to His disciples and found them
sleeping, He rebukes Peter, "Could ye not watch one hour with me?"
He addresses Peter rather than the rest, because be had most loudly
boasted that he would not be offended.
Chrysostum: But as they had all said the same, He charges them all
with weakness; they had chosen to die with Christ, and yet could not
even watch with Him.
Origen: Finding them thus sleeping, He rouses them with a word to
hearken, and commands them to watch; "Watch and pray, that ye enter
not into temptation;" that first we should watch, and so watching
pray. He watches who does good works, and is careful that He does
not run into any dark doctrine, for so the prayer of the watchful is
heard.
Jerome: It is impossible that the human mind should not be tempted,
therefore He says not "Watch and pray" that ye be not tempted, but
"that ye enter not into temptation," that is, that temptation
vanquish you not.
Hilary: And why He thus encouraged them to pray that they might not
enter into temptation, He adds, "For the spirit indeed is willing,
but the flesh is weak;" this He says not of Himself, but addresses
them.
Jerome: This is [p. 912] against those rash persons who think that
whatever they believe they can perform. The more confident we are of
our zeal, the more mistrustful should we be of the frailty of the
flesh.
- Origen: Here it should be enquired, whether as all men's flesh is
weak, so all men's spirit is willing, or whether only that of the
saints; and whether in unbelievers the spirit is not also dull, as
the flesh is weak. In another sense the flesh of those only is weak
whose spirit is willing, and who with their willing spirit do
mortify the deeds of the flesh. These then He would have watch and pray that they should not enter into temptation, for the more spiritual any one may be, the more careful should he be that his goodness should not suffer a great fall.