Only if it is a professional and no mercenary army.
As already mentioned in the comments in the Hundred Years War and especially in the Thirty Year War the armies plundered and pillaged everything in their way. Especially in the latter war the civil casaulties where horriffichorrific as Central Europe lost nearly a third of its population.
Especially bad wherewere the marauding mercenaries as they had no fix income and no discipline. The imperial troops where a less harsh as they had at least some pay and sometimes the generals tried to recompensate the farmers for their losses.
Another thing to keep in mind is that in the Middle Ages there were only small contingents of standing armies. Most troops were recruited or conscribed in the case of war. So maybe the king of your medieval country has some kind of conscription system where a part of your population is used for the army whilst another part can tend to their home and fields and after a time some soldiersoldiers were released from their service and in change new recruits come from the villages. This would also reduce the risk of looting as nobody wants to raze their own village.
If a proper military discipline is maintained the scenario would likely be like Elmy's answer already pictured.