I don't think there was a war in Socrates lifetime, and historical books and documents have always said Athens sucked with it military. (At least what I found said that)
Was Sokrates ever a soldier?
Yes. He was in his late 30s when the Peloponnesian War (431-404 BC) broke out, and served in at least 3 major campaigns:
"When the commanders whom you chose to command me stationed me, both at Potidaia and at Amphipolis and at Delion, I remained where they stationed me, like anybody else, and ran the risk of death..."
-- Plato, Apology 28e
Plato is our source for Sokrates' military record, and no serious scholar doubts that his anecdotes are genuine. Across various dialogues, he tells us that Sokrates fought in the battle of Potidaia (432 BC) and took part in the long and costly siege of that city (432-430 BC), that he was present at the crushing defeat Athens suffered against the Boiotians at Delion (424 BC), and that he served during the disastrous campaign to recapture Amphipolis (422 BC). He may have been drafted for the first of these, or he may have volunteered; it is a matter of debate whether Sokrates had enough wealth to qualify for extended service abroad (since only the leisure classes were liable for this). If he was as poor as he claimed to be, he would have to have volunteered. We know that this must be true for the other two campaigns either way, since Sokrates would have been too old to be drafted for the field army. Men over 45 were primarily used as a home guard and rarely sent abroad.
The stories of Sokrates' military service are extremely useful to modern scholars because they present a unique view "from below" - an idea of the hardships and horrors endured by Athenian hoplites. Most historical accounts focus only on the generals and their decisions, and sketch the experience of the troops only in very broad strokes. Plato tells us instead about the panic and chaos of defeat, and how a man like Sokrates stood out from the helpless crowd of fleeing warriors. He has the young Alkibiades, whose life Sokrates saved at Potidaia, explain to his crowd of drinking buddies what he saw on the battlefield at Delion:
"I happened to be there on horseback, while he served as a hoplite. The troops were in utter disorder, and he was retreating along with Laches, when I chanced to come up with them and, as soon as I saw them, passed them the word to have no fear, saying I would not abandon them. Here, indeed, I had an even finer view of Socrates than at Potidaia, for personally I had less reason for alarm, as I was mounted; and I noticed, first, how far he outdid Laches in collectedness, and next I felt—to use a phrase of yours, Aristophanes—how there he stepped along, as his wont is in our streets, 'strutting like a proud marsh-goose, with ever a side-long glance,' turning a calm sidelong look on friend and foe alike, and convincing anyone even from afar that whoever cares to touch this person will find he can put up a stout enough defence. The result was that both he and his comrade got away unscathed: for, as a rule, people who act this way in war will not be touched; it is men fleeing in headlong rout that get pursued."
-- Plato, Symposion 220e-221c
Citing the comedian Aristophanes (Clouds 362) and slighting the experienced general Laches, Alkibiades shows how Sokrates and those around him survived the catastrophe by keeping their cool and persuading their enemies to find easier targets. According to Plato, Laches himself remembered these events all too well, and did not deny Sokrates his due praise:
"Indeed, Lysimachos, he is a person you must not lose hold of; for I have observed him elsewhere too keeping up not merely his father's but his country's name. He accompanied me in the retreat from Delion, and I assure you that if the rest had chosen to be like him, our city would be holding up her head and would not then have had such a terrible fall."
-- Plato, Laches 181a-b
As calm and collected as he appears in these anecdotes, so too does Plato present the man himself when he is asked about his experience of war. On his return from the battle of Potidaia, he is ambushed by people eager for news from the battlefield, concerned over the fate of their loved ones, but Sokrates talks like it was no big deal:
"Sokrates," said Charmides, "how did you survive the battle?"
"In the state in which you see me," I replied.
"It has been reported here, you know," said he, "that the battle was very severe, and that many of our acquaintance have lost their lives in it."
"Then the report," I replied, "is pretty near the truth."
"You were present," he asked, "at the battle?"
"I was present."
-- Plato, Charmides 153b-c
His own terseness about the whole ordeal - making him sound a lot like many modern veterans when asked about their experiences - is one of the things that has attracted the interest of those who study war trauma in ancient societies. There are some excellent recent studies on Sokrates' military past and its meaning in Plato's dialogues:
Mark Anderson, 'Socrates as hoplite', Ancient Philosophy 25.2 (2005), 273-289
Sarah Monoson, 'Socrates in combat: trauma and resilience in Plato's political theory', in Konstan/Meineck (eds.), Combat Trauma and the Ancient Greeks (2014), 131-162
Sarah Monoson, 'Socrates' military service', in Caston/Weineck (eds.), Our Ancient Wars: Rethinking War Through the Classics (2016), 96-118