Is it true that if a programmer writes a program, sells the program to a customer and customer commits a crime with this program, the programmer might be found liable by the court? I was wondering as there are many Turing complete languages that allow one to make something illegal. Also, there are some robot cars, and if one calibrates them incorrectly, those can commit crimes. So can a programmer ever be liable if they have not done anything illegal with software, but the customer does?
Without a specific jurisdiction, it is difficult to provide a precise answer. But in most places, a piece of software is no different from any other product. The nature of the software will likely be scrutinized, but in the majority of cases no blame will be placed on the programmer.
Compare it to a chainsaw. You can use it to commit crimes, but it is unlikely that the manufacturer will be held accountable for what you did.
However, if it can be proven that the damages are due to mistakes on part of the original developer, they might get sued over that.
EDIT: The answer above had been written under the assumption that the developer had no ill intent when creating the software. However, as pointed out by Charles Duffy and Philipp below, the legal consequences are different for software developed with criminal intent. In such cases, the developer will be prosecuted over the software. A common, though not universal, test to determine guilt in such cases is to determine if there are legitimate uses for the software.
Some jurisdictions have laws which make it illegal to create a software which is intended to commit crimes (usually computer-related crimes). For example, the German criminal law §202c StGB makes it illegal to create (or sell, convey, etc.) a program which has the purpose to commit crimes against the previous paragraphs 202a (stealing data) or 202b (intercepting data).
The constitutional court later clarified that this law is only to be used against programs which serve no other purpose than to commit crimes and not against "dual use" tools which can also be used for legitimate purposes.
So if one were accused of committing the crime of creating such a program, then a possible defense strategy could be to convince the court that they never intended for their program to be used to commit crimes.
In Sony, film and TV studios were suing Sony for manufacturing VCRs. Some people at the time were using VCRs to record copyrighted content from TV broadcasts and would then sell the recordings. The plaintiffs claimed that Sony should be held responsible since they were selling these devices that were being used to break the law. The Supreme Court ruled that VCR manufacturers could not, in fact, be held liable for breaking the law because the device was "widely used for legitimate, unobjectionable purposes" and had "substantial noninfringing uses". The fact that a small group of people was using them to break the law was not enough to ban their sale or punish their manufacturer.
The Grokster case was similar. Grokster was a peer-to-peer file sharing platform and was being sued by rights holders for distributing copyrighted material. In this case, the Supreme Court ruled that Grokster was indeed liable for "contributory" copyright infringement, even though the software had the same sort of "non-infringing uses" discussed in the Sony case. The court's opinion stated:
We hold that one who distributes a device with the object of promoting its use to infringe copyright, as shown by clear expression or other affirmative steps taken to foster infringement, is liable for the resulting acts of infringement by third parties.
The difference is that Sony sold VCRs for the purpose of legal, in-home use and some people figured out how to use them to break the law. Grokster, however, published software that was designed for breaking copyright law and was advertised for that purpose. Since they were actively contributing and encouraging the illegal actions of others, they could be held liable for those illegal actions.
So to summarize, if you're talking about a general-purpose piece of software that a user figured out how to use to break the law, then the software's creator is probably okay. If the software was designed to assist in breaking the law or the software's creator knew it was primarily being used to break the law, then they might have some legal problems.
It depends on the crime and the software. If the programmer writes code so that an accomplice can penetrate bank networks and drain customer accounts, the programmer can be prosecuted. If a programmer writes code that processes text messages on cell phones, and one of the users of the software uses the software to commit a crime, the programmer is not prosecutable. It depends on whether the programmer had criminal intent, and whether the software has innocent uses.