Scholars have different opinions about this. By default, praying behind them is not valid because they don’t observe the proper conditions of Salat. However, there is something called Taqiyyah. If one is in danger and must pray with them, you can pray behind them and your prayer is 100% valid and no need to repeat it.
But if there is no danger, and you go there just to keep good ties with them, then some scholars state the previous Taqiyyah rule applies while some say no. As a precaution, either you yourself recite the Surah when praying Jama’a with them, or repeat it later. And when praying Jum’a with them, as a precaution pray Salat al Dhuhur.