There were so many great answers to this question, and although I'd thought about this question before, the answers that people shared made me re-examine my own answer, and come up with something I'd always known, but never realised.
First, here are some of the other answers (used by permission):
"Because it makes me happy. Whether or not I get published. Ever. I will ALWAYS write." ~ Lady Glamis
"I like to entertain. Be it myself or the people who wish to read my stories, that's why ... Plus, I get to do whatever the heck I want! It's not like you can go about destroying solar systems on a daily basis in real life without a few people protesting. ;)
"Writing allows me to push personal boundaries and learn; it lets me vent frustration in safe ways (except maybe towards characters, who are never safe); it keeps me entertained and occupied and I enjoy it. There are slumps and periods of Isucktis, etc, and getting out of them is not always quick or easy, but in the end, I still enjoy what I do. I get very real satisfaction blowing things up--it's soothing. B-)
"As for publication, it may be a slim chance, but just think: there still IS a small percentage of people that get their books published. I see nothing wrong with aiming to be in that percentage. Even if I don't make it though, I will keep writing, keep trying. You lose every chance at your dream if you give up on it." ~ Merc
"Books have given me so much comfort in life, I want to at least try and give the same to others. Some of my wips, well I want to show that my religion isn't as bad as it can be made out to be. Sure, there are nutters, but which society doesn't have them? Merc made me realise something. Yes, we get to do a lot of things in writing we ordinarily can't do in RL. Those that know me, well they'll appreciate how much more I enjoy writing because creating my characters means at least part of me can be 'normal'. It's nice though, when RL comes with strings attached, to be free in wips." ~ Yunaleska
"Because it's an addictive escape. Have you noticed how many writers' families say that we are in our own world. Especially if we are writing and on CC at the same time. What the fire is burning down? Ah no it can't be, Abi just got on her horse, you'll have to reschedule, sorry." ~ Rie
See anything common in their responses? I think it's something common to my response, too: writing is freedom. In writing, we are free to explore ideas, concepts, situations that we might never encounter in real life. We are free to be whomever we want as we dip into the heads of all our characters, and we are free to recreate the world in our own image.
That's writing. But what about sharing what we write? If all we wanted was the freedom, we could write all day, quite content in the knowledge that no one will ever see what we have written. So why do some of us have this drive to show our work to others?
I think affirmation is part of it - we want to have someone else affirm that what we think, what we believe - what we have created - is worthwhile. But there's more to it than that. You know I go on about things like themes and meaning and legacies... And I know that's part of why I write.
But you know what? I'm not actually quite sure what part. I don't know what it is that I hope to gain by sharing my writing with people. I want to make them think, I know that - but why? Why is it so important to me that others think and reflect, and have cause to develop opinions and ideas of their own?
*grin* So I guess that's another part of why I write - to figure out why I write, and what it is that I want to say. There's a quote that my creative writing teacher in my undergrad degree used to spout at us all the time. I've forgotten who said it originally, but I love the sentiment:
How can I know what I think until I see what I say?
Yup. I can identify with that.
And that brings me to the final reason for the day: I write for me, too. I write because, to me, my stories mean something. In a weird, twisted kind of way, they expand my thinking, open my mind, and force me to challenge all my beliefs and perceptions. Writing isn't a comfortable task - at least, not if you do it well.
And you know what?
I think I like that.