Google's Matt Cutts was asked this question and responded directly in a video (Aug 2011):
Do spelling and grammar matter when evaluating content and site quality?
At least the last time I checked (which was a while ago), it is not used as a direct signal within our rankings. So its not one of the 200 different signals that we use to assess the quality of a page.
But I think it would be fair to think about using it as a signal. We noticed a while ago that, if you look at the PageRank of a page — how reputable we think a particular page or site is — the ability to spell correlates relatively well with that. So, the reputable sites tend to spell better and the sites that are lower PageRank, or very low PageRank, tend not to spell as well, which is a pretty interesting effect if you think about it.
So for example, take spelling and grammar. There’s an inherent assumption in that question that you are talking about the spelling and grammar of a particular language. And so in order to figure out how is the spelling and how is the grammar, you have to figure out what is the language of that page. And even if you have the best language identification in the world, over tens of billions of documents, you’re going to find that maybe there’s a few pages that you missed.
And so you might think that this page has awful spelling or awful grammar, but it turns out it’s really just in Hungarian instead of in English. Or maybe a paragraph or two is in Hungarian, instead of English. And so it’s not the case that you can automatically say, aha, this will be a perfect signal. That’s why we try to do a lot of evaluation. We do a lot of testing to see whether something is really a quality win, whether it matches our intuitions. But it is the sort of thing where it turns out in our experience the more reputable pages do tend to have better spelling and better grammar. And so if you can put in the time to make sure that something is edited well, you’ll find it’s probably not just a good overall piece of content that’s more likely to stand the test of time, but probably users will appreciate it. People can understand when they land on a page whether something is a little bit knocked out quickly versus somebody put a lot of work into it. There was a copy editor or someone did some fact checking or they’re an expert on the subject.
And so, when at all possible, I certainly try to pay attention to spelling and grammar, even when I tweet. Sometimes you mess up, but it is something that I would encourage people to pay attention to, maybe not necessarily for the search rankings directly, but just because it’s a good experience for users and users appreciate that. They’ll be a little more likely to bookmark you or come back or tell their friends about you.
Bing's Duane Forrester now says that Bing is taking spelling and grammar into account in the rankings (Feb 2014):
Quality: Do You Have It, or Just Think You Have It?
...
If you struggle to get past typos, why would an engine show a page of content with errors higher in the rankings when other pages of error free content exist to serve the searcher? Like it or not, we’re judged by the quality of the results we show. So we are constantly watching the quality of the content we see.