Historical Context of the Art of War
The Art of War was written during China's Spring and Autumn period. This period could be likened to the pre-World War II Europe. Small dukedoms and kingdoms had been consolidated in previous conflicts. Only a few, large kingdoms remained in a state of tension with one another. There was peace, but everyone knew it wouldn't last.
It didn't. Eventually wars broke out that lasted hundreds of years for what came to be called the Warring States Period.
Nevertheless, for the time being there was peace and prosperity. Around this time, several philosophies were developed that later greatly influenced China and the world.
Confucius was travelling around, not very far from Sun Tzu. His ideas eventually came to dominated Chinese Rulers' methods as 'Confucianism'.
Lao Tzu's philosophy was transcribed into the Tao Te Ching, eventually becoming Taoism.
The Buddha was teaching in India. His teachings came to China where they were "China-ized" into Zen and Pure Land Buddhism.
Sun Tzu's book developed a life of its own, finding its way into the hands of Chinese General centuries after his death.
These ideas were much discussed during the Spring and Autumn Period, but really came into their own during the following Warring States Period. The Rulers knew that the constant killing and war couldn't continue, but lacked the means to stop it. Eventually Confucianism and Sun Tzu came to the fore. It was a great combination because Confucius generally refused to speak on the issue of war claiming ignorance of it. Sun Tzu and other military thinkers filled the gap.
Importantly, Confucius did not deny the occasional necessity of war, although, like Sun Tzu, he felt it was extremely undesirable.