"It may be the case that the interests of Islam require Muslims to vote so as to ward off the greater evil and to reduce harmful effects, such as where two candidates may be non-Muslims but one of them is less hostile towards Muslims than the other, and Muslims’ votes will have an impact on the outcome of the election. In such cases there is nothing wrong with Muslims casting their votes in favour of the less evil candidate."
-IslamQA