In recent weeks, a number of prominent professor-bloggers have criticized the tenure system, including Bryan Caplan, Freakonomics author Steve Levitt, Brian Tamanaha, and our own David Bernstein. These writers all point out that tenure protects shirkers and mediocre scholars. I would add that it also protects professors who are bad teachers or mistreat students in ways that fall short of the very severe offenses (i.e. - serious sexual harrassment or other criminal misconduct) that would allow the school to fire a tenured faculty member. I also agree with Bryan Caplan and David Bernstein's suggestion that tenure persists despite its inefficiency in large part because universities are nonprofit or governmental institutions that have little incentive to adopt efficient policies.
However, none of these writers fully address the main argument in favor of tenure: the claim that it is needed to protect the academic freedom of professors with unpopular political views. That argument is not completely without merit, but is very much overstated.
As David mentions in his post (linked above), the institution of tenure is not enough to prevent ideological discrimination in academic hiring. A faculty that wants to discriminate can still do so in entry level hiring or at the point when it is decides whether or not an assistant professor gets promoted to tenure. If the faculty or administration is intent on enforcing ideological conformity, it can usually do so quite effectively even without having the ability to fire tenured professors. If it is not, then tenure is probably not needed to protect academic freedom at that particular institution.
At most, therefore, tenure will only protect the academic freedom of professors who either 1) manage to keep their unpopular views hidden from their colleagues until after they get tenure, or 2) have a road to Damascus conversion to unpopular views after getting tenured status. Such cases are not unheard of, but they are likely to be extremely rare. Tenure might also occasionally protect a professor whose views are generally acceptable to his colleagues and the administration, but who occasionally makes a stray unpopular or un-PC remark. For example, Ward Churchill's far left views were apparently acceptable to the University of Colorado administration and faculty (at least to the extent that they didn't want to get rid of him) until he really went off the deep end by calling the victims of 9/11 attack "little Eichmans." I suspect, however, that, even in the absence of tenure, it is unlikely that universities will often seek to fire professors just for making one or a few isolated controversial comments.
There is no way of perfectly protecting professors who convert to political views unpopular with their colleagues or make controversial remarks. However, perfect protection is probably unnecessary, because cases of firing for such reasons are likely to be rare. Moreover, universities can take steps to further reduce their likelihood. For example, they can sign professors to multiyear contracts that include provisions forbidding the school to fire the person (or refuse to renew his contract) for political or ideological reasons. Such contracts won't be perfect; a crafty administration could fire a professor for ideological reasons while concocting a plausible cover story showing that they "really" did it for a legitimate cause. However, I doubt that universities will often do this, especially given the threat that the professor in question could sue the university for breach of contract and create adverse publicity for it.
Ultimately, tenure probably does provide some protection for academic freedom beyond what we would have otherwise. The real issue, however, is whether this small increment of academic freedom is enough to justify the very high costs of the institution. At least at most schools, I suspect that the answer is no.