One of the common things you hear said about science fiction is that it's about "predicting the future."
It's true that science fiction has predicted a lot of things. Here are a few examples:
1. By an amazing guess Jonathan Swift, in Gulliver's travels, tells us that Mars has two moons. He even got the orbital periods right...
2. In From The Earth To The Moon, Jules Verne put a major launch site in Florida, the location of current Cape Canaveral. Because of the earth's spin, it's safest to launch rockets on an east coast (or on the west side of a poorly inhabited desert, which was the Soviet choice) - so this is a fair prediction, even though he thought we would be firing space capsules out of giant guns. Then again, rail guns are a potential idea for the future.
3. H.G. Wells put giant, armored, wheeled war machines on land in 1903. The first tanks were deployed in 1916.
4. In 1911, Hugo Gernsback had a character use a video phone in his serial Ralph 124c 41+. The first video phone showed up in 1964, although we now use computers and tablets more than phones for video talk - the larger screens help.
5. And in 1945, Arthur C. Clarke predicted geosynchronous communications satellites being used for television. Before broadcast television existed.
So, is the purpose of science fiction to predict the future? Not really. Trying to predict the future is fun, but not all science fiction is about it. And some science fiction, of course, predicts a future none of us would want to see. Dystopian fiction is extremely popular right now, most recently with The Hunger Games and Divergent, but older classes such as Brave New World enjoy some popularity. And apocalyptic fiction is a sub-genre with some staying power - books such as Ill Wind (Kevin J Anderson and Doug Beason), Wool (Hugh Howey) vie with classics such as Lucifer's Hammer (Jerry Pournelle and Larry Niven) and A Canticle for Liebowitz (Walter M. Miller, Jr.). All of these are still science fiction, but they aren't predicting a future we should work towards. In some cases, they may warn us of one we should avoid.
If it's not predicting the future, then why write science fiction? What, other than entertainment, is its purpose?
I'm going to put forward a different hypothesis. As editor of Analog, Stanley Schmidt defined science fiction in 1999 as "fiction in which some element of speculation plays such an essential and integral role that it can't be removed without making the story collapse, and in which the author has made a reasonable effort to make the speculative element as plausible as possible." So, what's a speculative element?
It's simply a "what if." What if you could build a submarine and thus become self sufficient? (Jules Verne's 20,000 Leagues Under The Sea). What if a giant asteroid hit the earth? (Lucifer's Hammer). What if a plague turned most of the population into zombie-like animals? (My own recent release The Silent Years).
So, the purpose of science fiction, by that definition, would be to postulate a "what if" and then answer it. Nothing more, nothing less.