There are many debates as to what exactly the Imprisoning War is. It is mentioned in many games, and generally refers to a struggle between Link and Ganon. I have compiled many known explanations of what the Imprisoning War is. I have written up my own explanation as well, which you will find below.
The Zelda Capital Imprisoning War Theory: This is the theory that we officially support. This theory states that the Imprisoning War is the battle that begins when Ganondorf kills the king and the Knights of Hyrule try to seal Ganondorf away. It ends when Ganondorf is sealed away in the Sacred Realm by the sages after he is defeated by Link. So, basically, everything that happens after Link pulls the Master Sword from the Pedestal of Time until the point where Ganondorf is defeated is the Imprisoning War.
Early Imprisoning War Theory: This theory states that the same Link plays in Ocarina of Time, Majora's Mask, Legend of Zelda, and The Adventure of Link, and that all of these games came before the Imprisoning War. Then The Wind Waker takes place centuries later, A Link to the Past and Link's Awakening centuries after that, and Oracle of Seasons and Ages happened centuries after that.
Second Early Imprisoning War Theory: This theory states that the first Multiple Links Theory is correct, (visit our Multiple Links Theory page to see the theories) and then the rest of the first Early Imprisoning War Theory is correct.
Late Imprisoning War Theory: This theory states that the Imprisoning War happens during Ocarina of Time (during the seven years Link was asleep in the Chambers of Sages), and The Wind Waker happens centuries later, and The Legend of Zelda and The Adventure of Link happens centuries after that. Oracle of Seasons and Oracle of Ages happens centuries after that, and A Link to the Past and Link's Awakening happens centuries later.