Krishna explains Swa-dharmam (own nature) (2.31-2.37) and he tells Arjun that such an unsought battle (Kurukshetra) opens the door to heaven (2.32) and escaping from it would result in loss of Swa-dharmam , fame and would incur sin (2.33). This advice to Arjun on the battlefield needs to be viewed in the right context. Krishna is actually talking about harmony and synergy with one's swa-dharmam and not about a war.
Krishna finds disharmony between what Arjun is, his thoughts, utterances and actions. He attempts to guide Arjun towards harmonizing them. In case of Arjun, the harmony is in fighting the battle as per his Swa-dharmam and disharmony is in avoiding the battle.
In fact, harmony rules creation where the smallest electrons, protons and neutrons to biggest galaxies, planets and stars are in harmony. We enjoy our favourite music only when the radio and radio station are in harmony (tune). There is no greater example of harmony than the human body consisting of so many organs and chemicals, whose synergistic functioning makes us what we are. Harmony refers to things and situations as they are, not as we desire them to be in our frame of reference and value system.
Since our childhood, we have been taught that good deeds take us to heaven and bad deeds to hell, after death. Krishna indicates that heaven and hell are not after-life places but exist here and now, depending on whether one's potentiality meets opportunity or not.
When we understand others' swa-dharmam , harmony comes in families, workplaces and relationships which is heaven and the lack of it is hell. We experience pleasure and pain depending on whether our desires are fulfilled or not. When internal harmony with Swa-dharmam is achieved, it is heavenly irrespective of the outside world.
Source - Daily World