How important is knowing how to program for TCS? Coming from a more mathematical background, I never really learned how to code.
I am starting a PhD in TCS and many people were surprised by how little I knew about programming (and about computer in general). I can write algorithms in pseudo-code, but I don't really know any programming language.
I can imagine that someday I may have to implement some algorithms for my work, but then can I wait for this moment? Or is there something more?
How important is knowing how to code in TCS (in fields where programming is not directly involved)?
Are there reasons which could bring a CS theorist (for example) to know how to code? Is it worth spending a lot of time learning how to code? And if there are, is there a category (functional, imperative, object-oriented...) of programming language that would be more suited?
Theoretical computer science is a broad field and the importance of programming depends on what you do in TCS.  I will mention two ways in which programming can help you, without implying that these are the only ways.

First, if you design algorithms for problems of practical importance, implementing your algorithms and making the code available to others can be a big plus.  For example, the convex hull problem arises in many fields, and people use software packages such as cdd by Komei Fukuda and lrs by David Avis to solve this problem.  If they had published their algorithms only in papers, probably less people would have used their algorithms.  More users mean more feedback and probably also more opportunities to collaborate, which is invaluable.

Second, even if you do not work in algorithms, writing a one-time code helps you to test a simple conjecture when the conjecture is suitable to numerical calculation.  For example, if you wonder whether the product of three positive definite matrices always has a positive trace, it is easy to write a code to test it for some random choices of 2×2 or 3×3 positive definite matrices and find a counterexample.  Although you do not advertise that you wrote any program to test the conjecture, programming can save the time which would have been spent in vain trying to prove a false statement.

The programming language to choose depends on what you want to do with programming, and it can be a topic for a whole book in my opinion.  But if you design algorithms and want to implement your algorithms so that other people can use the implementation, then one important factor is availability.  Although you can expect that most potential users of your code have access to a C compiler, you cannot expect that the same people have access to a Haskell compiler.  For one-time programs, the choice is more based on available libraries, and includes the environments such as Matlab.

By the way, programming can also be fun.