This question is so broad, the answer will depend pretty much entirely on what you want it to be. It would be easy to name many cases in which war produced technological innovations, but just as easy to cite many cases in which it didn't. Whichever point you want to prove, you can pick your examples to match. Someone who reads the question and thinks immediately of the World Wars will say "competitive arms development, and the wartime challenges of logistics and medical care, contribute to technological invention and improvement in ways that might otherwise have taken longer, if they would have happened at all." But someone who thinks of, say, the Peloponnesian War might answer "war is only a destructive force; the priorities and costs of war actually inhibit any technological development that might otherwise have received the necessary funding, manpower and thought." Whole swathes of human history attest to the fact that endemic warfare often produces anarchy and poverty, not innovation and technological change.
This is complicated by the question whether the particular technologies developed in wartime (and for the sake of fighting wars more effectively) actually matter outside of that context. Wars may make a society better at fighting wars, but does that help anyone in society at large? It's easy to point at technologies that were invented for a military purpose and have since made the leap into civilian life; but similarly, it's easy to point at technological innovations (like, say, siege towers or anti-tank shells) that serve only to solve military problems and don't contribute anything to the way people live.
The guide you offer into these hugely subjective topics is that you're asking whether society needs war as a way to propel technological change. The implied assumption is that without wars, such change might not happen at all, or at a much slower rate and in fewer ways. This framing would theoretically allow us to put all of the war-related technology of history onto a big pile and ask (passing by the question whether all of it has a use in society) whether war was needed to produce all that, or whether it would have been developed regardless. But the problem there is that there's no cut-and-dried distinction between "war tech" and "civilian tech." They build on each other. For example, the steam engine was invented in an entirely civilian context and applied first in industries like mining and cloth making. But then it was adopted by navies to propel ships, which then kicked off a host of military innovations related to the new energy source. Modern tanks may be marvels of offensive and defensive technology, but the first tanks were designed around readily available agricultural tractor chassis. Does society need war to generate more advanced technology, or does military technology need society to produce things that allow it to develop?
Any answer will inevitably devolve into a chicken-and-egg question. Who actually owes whom for what? Which innovations can militaries wholly claim (especially given that modern military technology is developed in a network of government contracting and liaison with civilian industry)? Can we isolate the improvements made during certain conflicts and can we assume they would not have been made without those conflicts? How do we define "need" when we say that society needs warfare to propel technological change?
Such questions can only be answered on a case-by-case basis. Technological improvements need to be seen in their historical context: not just the when and why of their development, but the origins of their parts and their principles. You don't just randomly come up with radar or nuclear fission to fight wars better. Similarly, society at large doesn't just sit there waiting for the boffins at the War Department to give them these things to play around with. The development of new technology is a process with different people contributing for different reasons - some in the military, some in universities, some in their shed or their study. It's impossible to say categorically which side needs the other to make any progress.
Just as importantly, the mere existence of a military conflict does not speed up military innovation; there needs to be a context in which new technologies are available from other spheres and new technology is thought to offer opportunities for major tactical or strategic advantage. If these conditions are absent, wars will simply be fought in the tried-and-tested manner until one side wins. Many resources will be spent or destroyed in the process. It's not by definition an ideal environment for the development of different technology.
In short, we can't simply answer this question one way or the other. It is uncontroversial that research spurred on by war has contributed substantially to the improvement of existing technologies and the development of new ones (especially in recent times). After all, people invest ingenuity and resources in things that matter to them, and warfare has tended to matter a lot. On the other hand, it is also uncontroversial that technological innovation happens outside of the military sphere, and that militaries benefit substantially from this. It is also presumably uncontroversial that war is not primarily a creative force, but one mainly interested in enhancing its ability to destroy. Any attempt to resolve these contradictions in a single universal truism about war's influence on technology seems futile to me.
There's a bit of determinism wrapped up in this question that I'd like to tackle -- although u/Iphikrates and u/restricteddata have done a good job of delineating how we think of "technology" and how it's applied, and how our specific technological-collegiate-military-industrial research-driven era is very much a product of the postwar period -- there's also a bit of an assumption that technology wins wars, and the side that techs the best will win.
I'd like to tackle this by relating the question to ships and shipbuilding, which seems like it's an obvious area where "better technology" will win the day. But the weird thing is that the early days of the English (later British) navy's real rise as a power started at least partly because they adopted an inferior technology.
I was reading about cannons the other day, as one does, and I was reminded of a major change in procurement that happened starting around the 1540s in England. Henry VIII was a Renaissance prince in many senses, not least his admiration for and desire to own many large guns. At the time, large cannons were cast from bronze, an alloy of copper and tin; while England (or Cornwall, anyhow) was rich in tin, copper had to be imported or guns themselves imported entire, which was expensive even for someone who dissolved monasteries and seized church property. (Copper was not discovered in England until Elizabeth's reign.) In the 1540s, though, crown investment in gun foundries in the Weald of Kent started to pay off in the form of cast iron guns, the first of which was cast in 1543.
Iron is not nearly as good a material as bronze for casting guns. Iron melts at a much higher point than bronze; it is heavier (more dense) than bronze; it is prone to flaws in the casting, which can compromise its strength; the black powder used at the time will corrode the inside of the gun (sulphuric acid is one of its combustion products).
Iron guns will also burst without warning, whereas bronze guns will bulge around flaws and then split. This was a major drawback for gunners at the time, who had no way of calculating how much powder and shot a gun might be safely charged with, other than by loading it and firing it off.
But the crucial advantage iron guns had over bronze ones was that they were substantially cheaper -- medieval England was rich in iron, and iron guns and shot (bronze guns usually used stone shot) were between 10-20 percent of the cost of bronze guns. (The cost of iron guns actually fell by about 20-25 percent, from £10-12 per ton to £8-9 per ton, from 1565 to 1600, in a period of otherwise rapid inflation.)
So, the iron gun was heavy, of uncertain strength, and prone to bursting without warning; but you could also get 5 or 10 iron guns for the cost of one bronze gun. The Royal Navy was still armed mostly with bronze through Elizabeth's reign, but cheap iron guns were suddenly widely available for smaller ships, including many that straddled the late-Elizabethan line between private commerce, privateering, and piracy.
So the reason for this rather long-winded answer is to point out that the measures we're often drawn into for what technology is "better" don't always match with how the rubber meets the road. The Japanese Zero was a "better" aircraft than the Grumman Wildcat for values of "better" that value speed, range and dogfighting, but the Wildcat racked up something like a 6:1 kill ratio when pilots fought in pairs and took advantage of their planes' ruggedness. British-built ships in the period I study are often argued to be "worse" than French and Spanish designs,, yet Trafalgar was so decisive a British victory that it was the last fleet combat for 111 years. Warfighting is not just about the stuff, but also logistics, training, performance and a host of other things.