It works well enough to be a consistent strategy, but you have to be careful taking too much from a given piece of territory. Eventually, the locals start getting unhappy with you.
And then there's things like the Thirty Years' War, where armies foraged their way through territories often enough that eventually there was nothing left.
There is more than one way to forage. At best, the army can pay the local inhabitants, maybe even a fair value, particularly if the area is nominally friendly. Even if the army "commandeers" supplies, it would want to keep the criminal activity to a minimum, if only because it is bad for discipline.
The Thirty Years' War is an extreme case, in large part because the armies were made up of mercenaries that were not getting paid regularly.
I think that with Thirty Years' War, it was not just "foraging"bur also religious cleansing. It was kind of genocide. They did not had word genocide yet, but generally it fits.
And then there's things like the Thirty Years' War, where armies foraged their way through territories often enough that eventually there was nothing left.