Switching field after a PhD in math I am about to finish a PhD in mathematics with a thesis in an area in between differential geometry and PDE. I still have more than half a year, but I want to start thinking about my future. 
In the last years there were moments where I was feeling quite depressed and frustrated, but overall I have to say that I have enjoyed my time as grad student. I love learning new things and being challenged by some nice problems. 

At the moment I don't feel like pursuing a post doc in my field. First of all, I am scared of getting stuck in a sort of "dead end" (it could happen that after doing several postdocs around the world I will not find any permanent position and at that point I will maybe be too old to do something else..).  Secondly and most importantly, I don't know if I like math enough. It's a nice and interesting activity, but I'm not sure if I want to dedicate the rest of my life on that and I feel that I don't have enough motivation for fighting for a job in academia. 

Working on some topics related with the ecological and climate crisis that we are facing, would probably motivate me more than just dealing with theoretical problems in differential geometry. 

My questions: How common is to switch field after a PhD? Could I get a job in some research institution (possibly in Europe) where I could do research maybe on ecology or climate change?
I don't have any statistics about how common it is, but that shouldn't really concern you. The more important question is whether it is possible. 

I assume, without statistics, that in a competitive job market that many people must, in fact, change their direction. If there are too few jobs then people must look elsewhere or find a way to be more competitive themselves. 

The issue you face is really only finding a job. To do that you have to be attractive to the ones offering the job. Math is a great background on which to build as it gives you analytic and deductive skills that can be brought to bear on many problems. But you can also appear over-qualified for some positions. 

But if you want to work in specific fields, you probably need to get some qualification in those fields, even if it is pretty informal. Employers probably don't want to support you while you learn if it takes too long and there are other, better qualified, candidates. 

Some applied math or statistics might put you in a better position. 

But you need to search out jobs, selecting those that best fit your skills, but also finding a way to promote your skills as appropriate. 

You might, in fact, look for a "bridge" position, say as a postdoc, that gives you time and an opportunity to get some qualifications in an applied field that appeals to you.