I take this to mean that Jesus saw the significance of the baptism by John and the announcement that he was the Son of God. His ministry had begun. Maybe like, the reference in Mark to the driven nature of the wilderness experience, this all night prayer vigil was prompted by the Holy Spirit.
He had some heavy stuff going on. He had begun to preach and heal and great crowds followed him. Then he had a confrontation with scribes and Pharisees over a healing he performed on the Sabbath. Somehow that doesn't seem like an event that would prompt the all night vigil.
He had begun to select his disciples, and after this he called them to him and began to teach them in an event that is known as the Sermon in the Plain. Perhaps it was the training of the Disciples he prayed about all night. Perhaps he was looking toward the crucifixion. There are many possibilities.
Sometimes the Holy Spirit drives me to prayer. Sometimes I don't have a specific need. The purpose of prayer when there is no danger or urgent need is gratitude, thanks for God's providence and eternal blessing. Maybe Jesus felt that same gratitude. Maybe it was just worship.