First I voted "it depends", then changed my answer to "no" because people are lazy when it comes to definitions.
In order to program you need to think logically, you need to be able to reason through problems. You need to be able to explain a problem in terms of equations.
However, the ability to reason is very different than the study of reason. Most people are able to logically reason their way through problems without formal study on the rules of logic, how implication works, playing reasoning mind-games, or, (since you likely meant computational logic
rather than logic generally) study their way through formal languages of logic or proofs.
Also, due to lax definitions, I would say no to 'prerequisite', but yes to 'corequisite'. You need the material at the same time you are learning to program.
Logic is a big field. You can get advanced degrees in the study and expression of logic by itself. You don't need that as a prerequisite to beginning to program.
Finally, while I will agree that computer science can rely on formal logic, that is not the core. I would argue computer science is an application of general mathematics rather than logic. The machines are computational engines designed around mathematics, the values used in computation are a perfect fit within discrete mathematics, and when programmed the applications frequently align themselves around mathematics topics like linear algebra, trig, accounting and verifiability, cryptography, and more.
Do you need the ability to apply reason and the ability to break problems down, build problems up, and find equivalent solutions? Yes. All of these are areas of logic that you need while learning how to program.
Do you need formal study on logic, the history of logic, philosophy of logic, semantics of logic, logic in debate, logic in philosophy, logic in mathematics? No. While these can potentially be valuable in a career, and many people in computer science rely on them, they are not a prerequisite to programming.
Edited by frob, 28 February 2014 - 12:01 PM.