There is no historical evidence that this ever happened, however it is a true Chinese anecdote on the game.
- I could find no evidence of this anecdote in scholarly articles
- I did find a reference in the first English Go book, and it was mentioned as an anecdote
According to this scholarly article, which encompasses all major mentions of Go in history and provides a good number of reputable sources, the answer is no.
You will have to read the whole article to verify there is no trace of that story.
Interestingly enough, there is a little bit which may be interesting: the theory that Go was used originally for divination purposes. In this particular sense, it is plausible, but by no means confirmed or supported by known history, that Go may have been used as a divination tool in the context of a war.
The Shang were displaced by the Zhou, who shifted the emphasis of the oracles to predicting the influences of the heavenly bodies. This was the period when the enduring yin-yang theory took shape. Their view of the cosmos was widely admired and quoted even by later go writers. For example, in the "Yi Zhi" [The Essence of Go] the famous historian Ban Gu (32-92 AD) said: " The board must be square and represents the laws of the earth. The lines must be straight like the divine virtues. There are black and white stones, divided like yin and yang. Their arrangement on the board is like a model of the heavens."
Certainly though, there is no record of having a game of Go decide the outcome of a war as you mentioned.
Mention as anecdote
Such an example is mentioned as an anecdote in "The Game Of Go: The National Game Of Japan" by Arthur Smith
Anecdotes have come down to us from the old Chinese
times in regard to the game, of which we will mention only
one, which shows how highly it was esteemed.
Sha An, a man who lived in the time of the Tsin Dynasty (265–419 a.d.), carried on a war with his nephew Sha Gen. Growing tired of taking life, they left the victory to be decided by a game of Go, which they played against each other.
In fact, you can find no reference to a prince called Sha An on wikipedia.