It can be done, but it would requires additional equipment. Batteries are traditionally grid-following, so they'll just follow whatever frequency the grid is already running on. The frequency itself is then provided by the rotational inertia of "spinning metal" power plants.
But there's no reason that has to be your frequency source. Any single battery installation on its own is perfectly capable of making up some frequency, which is why home power banks with island-mode AC output are a thing - or even just a traditional UPS. Doing the same with thousands of individual battery installations across the grid? You'll need some way to get everyone to agree exactly on frequency and phase, which in practice is probably going to mean getting them to agree on time to within a few microseconds, which could be done (albeit not very sabotage-proof) using GPS.
But there's no reason that has to be your frequency source. Any single battery installation on its own is perfectly capable of making up some frequency, which is why home power banks with island-mode AC output are a thing - or even just a traditional UPS. Doing the same with thousands of individual battery installations across the grid? You'll need some way to get everyone to agree exactly on frequency and phase, which in practice is probably going to mean getting them to agree on time to within a few microseconds, which could be done (albeit not very sabotage-proof) using GPS.