This happened to me yesterday, when I had to play a 30 minute recital for the group of tourists from France in my church. Originally I was prepared to play the Mass for the Convents for them by Francois Couperin. But the group came in 45 minutes later because their plane was delayed. So we had less time than I planned. Instead of 45 minutes, just half an hour.
I had two choices - to shorten the pre-determined program or to improvise. I chose the path of improvisation. What happened there, you can see for yourself in this video.
You can try the same for yourself. Start anywhere and just keep going. The form, the harmony, the melodies, the rhythms, the texture, the registration will be dictated to you by some higher forces - by the Muses (as Greeks would call them).