The reason why Lord Krishna spoke the Bhagavad-Gita to Arjuna is to get him to do his duty of being a soldier by fighting in the war. Arjuna was also asked to think of Him (Lord Krishna) while performing his duty (of fighting in the war).

O son of Kuntī, either you will be killed on the battlefield and attain the heavenly planets, or you will conquer and enjoy the earthly kingdom. Therefore, get up with determination and fight.” (Lord Krishna, Bhagavad-Gita 2.37)

Before the two sides were on the battlefield, Lord Krishna, did ask both parties to settle their disputes peacefully and not get into a war. Arjuna agreed to a peaceful resolution, but the leader of the other side, Duryodhan, did not agree and declared war.

Warfare is not the topic of the Bhagavad-Gita, spiritual realization is the topic of the Bhagavad-Gita. The war was the most ideal situation for a discourse on the material body and the spiritual self (the soul).

Arjuna refused to take part in the war, because he was a very compassionate person and had over whelming love for everyone, including his enemies. He did not want to kill anyone. Compassion for all living beings is one of the qualities that a pure devotee of Lord Krishna has.

“Sañjaya said: Seeing Arjuna full of compassion, his mind depressed, his eyes full of tears, Madhusūdana, Kṛṣṇa, spoke the following words.” (Bhagavad-Gita 2.1)

“Sañjaya said: Having spoken thus, Arjuna, chastiser of enemies, told Kṛṣṇa, “Govinda, I shall not fight,” and fell silent.” (Bhagavad-Gita 2.9)

Lord Krishna makes Arjuna understand that when a soldier is on the battlefield and the other side wants to fight, then there will be war and the soldier will be forced to fight. So Lord Krishna makes Arjuna realize this basic common sense truth and instructs him on spiritual subject matters to prepare him mentally for the war. Thus Lord Krishna spoke the Bhagavad-Gita, starting from chapter two. The first chapter gives an overview of the battlefield scene.

The fundamental spiritual lesson of the Bhagavad-Gita is that the living entity is the soul and not the material body. Thus we are the soul and not the body. We (the soul) are eternal, we have always existed. We existed before our current body and we will continue to exist after this body.

“Never was there a time when I did not exist, nor you, nor all these kings; nor in the future shall any of us cease to be. As the embodied soul continuously passes, in this body, from boyhood to youth to old age, the soul similarly passes into another body at death. A sober person is not bewildered by such a change.” (Lord Krishna, Bhagavad-Gita 2.12-13)