On the 26th of April 1521, Luther left Worms. Prince Frederick had encouraged him to leave, promising him, rather indirectly, that we would be taken care of regardless of what the emperor decided. At this point, Charles had already issued the Edict of Worms though it would be a full month before it was officially signed into law.
For the first leg of his journey Luther was accompanied by the imperial herald but three days into their journey the herald left Luther's company. Luther and his friends traveled for five days after that before spending the night in Hersfeld where he was hosted by the local Benedictine abbot who even invited him to preach a sermon at the abbey. Luther had promised the emperor that he would decline such invitations on his way home but he couldn't refuse the abbot. Writing to Spalatin about it later he said "I had not consented for the Word of God to be bound."
He preached again on the 2nd of May when they passed through Eisenach where he had spent time as a schoolboy and where Conrad and Ursula Cotta who had given him shelter still lived. After leaving Eisenach, as they were passing through the Thuringian Forest Luther and his friend Nicholas von Amsdorf, who was traveling with him, were intercepted by two masked horsemen.
Luther was taken prisoner, blindfolded, and led through the forest to Wartburg Castle in the dead of night. While some sources suggest that von Amsdorf had been privy to the plan, the mastermind behind it all was Prince Frederick who had Luther ensconced at the castle as a protective measure, both for Luther and for himself.
For Prince Frederick tucking Luther out of sight for a period of time ensured that there would be some measure of peace in Germany in the wake of the Diet and Edict of Worms. It also meant that Prince Frederick could keep the peace with the emperor himself because once the Edict of Worms went into effect the Prince would be compelled to hand Luther over to the emperor if he was seen to be out and about in Wittenburg.