To me, improvisation is a skill that is developed over time. It is simply what in literature would be called "free-writing" - writing without a particular idea, just whatever pops into mind.
It has several functions:
1. Familiarization with instrument (getting to know the instrument, its limitations and boundaries, ...)
2. Familiarization of yourself through the instrument - improvisation is a way of getting to know yourself, how you express yourself through an aural channel.
It may have many more but I may not be aware of it.
I usually like to listen to my improvisations and see what I like and don't like. What I like I usually transform it into a proper composition (through several techniques not all too different from creative writing). What I don't like - I take it into account and try to analyze why I don't like it and how I can improve.
In a nutshell it is a form of quick thinking that allows you to explore your own expression.
Now, a few questions.
1. What other purposes do you think improvisation has?
2. Does improvisation aid in deliberate, and more careful composition? Should one practice more improvisation to build a better musical sense to incorporate in more serious and more conscious compositions*?
*My definition of composition is an idea that once materialized, is able to be transformed and subfigured through different techniques to form a piece of a certain duration.