Like more than enough people above me have said, it can both add to and detract from sales, although it probably does hurt most products overall to some extent.
That's partly because of how many more people are legitimately buying them than stealing them (usually). If piracy became rampant enough, then there would be a huge problem for companies--maybe not the end of the computer age, but still. As I see it, they are fighting to prevent the current situation from getting worse; if everyone realized that they could take what they wanted without consequences, or if the process became any more convenient, then piracy might occur enough to truly cause problems.
It reminds me of the "Tragedy of the Commons" concept, where each individual is motivated to act for his own gain at the slight expense of everyone else. You're never going to completely prevent that, but if everyone does so then the system becomes unsustainable. So I avoid stealing and piracy and try to encourage as many others as I can to do the same, in the (admittedly naive) hope that it might contribute to better or cheaper products in the future.