On the one hand, it solves the problem of seeding the network with coins. Otherwise, how could you kick this off in a fair way?
Secondly, mining "solidifies" transaction blocks, which acts as transaction verification for the network. Mining basically acts as prevention of "double spending" of coins.
Finally, mining keeps the money supply scarce (necessary for any currency) because despite everything just being bits, you can't just fake new coins without expending enormous amounts of computing power -- you need to prove you've done the work by solving hashes.
The bitcoin wiki has pretty good technical explanations of all of this.