It was a rhetorical question. Jesus was both fully man and fully God (Philippians 2:5-9) and, as evidenced by the verse you also mentioned (Matthew 26:39), He was conflicted about what was about to happen. He knew that He had to go through with it ("not mine but your will be done"), but His human nature did not want to die.
You also have to consider those three days that He would be buried before the Resurrection. The best Biblical reference to this is 1 Peter 3:18-20 which addresses that he was "made alive in the spirit". This suggests a death of the spirit. In the description of the Ascension by Luke (Acts 1:9-11), His spirit is taken up into Heaven, meaning He wasn't there when His body was killed.
I don't believe there is a consensus among scholars about where exactly Jesus' spirit went during that time, but it was not to Heaven. For the first time in Jesus' existence, He was to be separated from The Father. He and The Father and The Spirit are one and that separation must have been extremely painful to consider.
Jesus was the perfect man. But He was also man. He knew He would die, He knew it was to God's glory, and He knew that He would be apart from God for those three days. He was very conflicted. His last cry of anguish is the embodiment of that conflict and a clear representation of His humanity, but also His last hours are a clear representation of His Godliness. In the descriptions in Luke and John, His other "last words" are mentioned in which He asks The Father to forgive them, He tells the disciples to love His mother and His mother to love them, and He proclaims the Paradise awaiting them all with The Father.
So, to more directly answer your question: He did not have to ask The Father. He knew exactly why it had to be done. But He was still afraid.