A criticism of government that seems to arise quite frequently, particularly from a position of economic uplifting, is that governments always have more money for war than they do for social programs. Figures will be thrown around to illustrate this apparent injustice (I am not necessarily refuting that point here, simply not discussing it per se). However the comparison is not quite warranted for two simple and linked reasons.
Firstly, the presence of poverty or other lamented social ills tends not to represent an immediate threat to the existence and stability of the state and/ or government. They may well in the longer term, but not immediately, and so such problems will be perceived as a smaller threat than whatever matter requires military action to combat. Whether it be an issue of destabilising and continuing terror attacks, or an outright act of aggression by another state; the government can not expect to continue for long without either being toppled, usurped by an invading state, or replaced by an administration more willing or capable of acting.
Secondly, while states can and have functioned in the absence of mandatory wealth redistribution, one cannot do so without the function of defence, especially in the face of aggression. This role may be adopted by another entity or state, but this puts the recipient in a state of de facto submission to the sovereignty of the provider. In essence this is the case because the provider may replace the recipient government at any time, with no recourse except by the consent of the provider. Ergo, defence, by the means dictated as necessary by the government, is an inextricable element of sovereign government. We may disagree on the wars that are deemed necessary, but not that they are the highest priority of any government.