This is one of the most frequently asked questions about the world of ethical hacking. Do you need to learn how to program to become a penetration tester? The answer would be "You are NOT going to be a good hacker."
Ethical Hacking is a loophole for us to do what we love and actually get paid to do it. Every hacker to get their start with an intense curiosity about computers, networks, etc. and how they all work together. Programming languages allow us to create anything we can imagine. If I was an architect, I could design any shape building I wanted, BUT it had to adhere to the laws of physics so that it was structurally sound. In programming, there are NO laws. ANYTHING can be created.
When people start in computers, they usually take every programming class they could. Read every single book you could. You have to be obsessed with all that could be done on a computer. Programming skills are what set apart real computer gurus and the script kiddies who just run programs (they didn't write themselves) to wreak havoc.
There are plenty of topics within Ethical Hacking that require no programming skills whatsoever. But if you truly are looking into a career as an Ethical Hacker, you are like me and want to learn as much as you can about everything computing. There are hundreds of programming languages to choose from compiled languages like C to scripting languages like Python and Ruby that are interpreted on the spot. Occasionally, dive deeper and play around with esoteric languages such as Befunge where the whole point of the language is to be completely obfuscated. It turns to programming even the simplest of programs into a mind challenging puzzle.
Whatever your interest is, programming languages are necessary for a fuller understanding of how computers work, process things, and communicate with each other. The next important question is: Which programming languages should I learn to stay competitive?
The answer to this will vary from programmer to programmer. My advice is to learn a language or two from each category. You'll begin to find that most programming languages work similarly but with varied syntax.
Starting off, Start your career as it is described here. It is an extremely powerful Object Oriented programming language and is widely used in today's world.
If you're beginning to feel comfortable with Java, I would suggest stepping it up and trying to tackle C++ or get down even closer to machine code with C.
Scripting languages are becoming extremely popular and are definitely worth looking into especially for the aspiring Ethical Hacker. I would mess around with LISP, Perl, Ruby, and Python. Find one or two you like that suit your needs and master them. Each one has its advantages.
There is unlimited information online to learn any of these languages and get started on your journey to an exciting career as an Ethical Hacker.