Was there ever a prophet in Tanach that was both a prophet and a military commander?
Joshua was visited by a malach of extremely lofty level (though he might not have technically been a prophet). It's also written a few times that God spoke to Joshua, such as in Joshua 1:1-9, 4:2-3, 4:15-16, 5:2, and more. He was visited by a malach who identified himself as the "general of of God" in 5:13. Rashi (5:15) identified the malach as Michael. Joshua wasn't called a prophet by the Sages in the sense that it wasn't his main vocation, but he was granted prophecy at times.
King David was granted prophecy (see last chapter of Shmuel B 23:1-7).
Shlomo was also granted prophecy once when he had the dream in which God promised to make him wise, and, as the king, he was the commander in chief, but he did not fight any notable wars.
King Saul was a military commander, as is known. He was also a prophet, temporarily. See I Samuel 29:24.
Samuel had anointed David as "king". Saul became crazy and was constantly afraid that David would usurp him, so he made numerous attempts to try to kill David. In one incident, David fled to join Samuel at his home. Saul first sent several groups of messengers to retrieve David, and each of these messengers began to prophecy when they approached Samuel. Eventually, Saul, himself went to Samuel, and he also became a prophet.