Originally, Co-Founder Mark Zuckerberg
used custom-developed PHP or PreHypertext Processor.
But as the platform evolved, the makers needed to add more agility, scalability and better performance to it. So, they addedmany new programming languages to it.
(Courtesy: Python Anywhere News)
At present, while the front-end is PHP, at the backend they use C, C++, Java, and Python. In addition, Erlang is used for Facebook chats. And I am sure there are many other languages like XHP, Haskell, D and Hack that they use in different features, apps and add-ons.
(Courtesy: Hacker noon)
All these programming languages are integrated to Thrift framework that enables a seamless communication between them and a consistent experience for the users.
Hope this answers your question.
(Courtesy: Extreme Tech)