Yes, of course it's ok. The role of a government is to do what is in the best interest of its citizens. If there is a possible threat from a foreign adversary, the government should deal with it.
There's a difference between the government banning an app from a country entirely, and banning anyone in their military from using an app or even a smart phone or anything with a camera, especially inside a military base!