The law of Karma or Kamma (Pali) originated in the Vedic system of religion, otherwise known as Hinduism. As a term, it can at the latest be traced back to the early Upanishads, around 1500 BC.
Karma first came into being as a concept in Hinduism, largely based on the Vedas and Upanishads. One of the first and most dramatic illustrations of Karma can be found in the great Hindu epic, the Mahabharata. The original Hindu concept of karma was later enhanced by several other movements within the religion, most notably Vedanta, Yoga, and Tantra.
The Bhagvad Gita says of karma : Brahman is the indestructible, the supreme; the Self is called the essential nature, and karma is the name of the creative power that causes beings to exist. ( pp 77 verse 3 translated by Eliot Deutsch university press of America, 1968 )
What is meant here, is an idea that is truly ineffable - no words will suffice to explain it properly - which is why "proper" explanations are not to be found in the works of scholars - as important as their work is. Those in the know recognize the spark of wisdom in others but admit to each other that words are not enough - that the very existence of words forms part of the problem. The best that one who has experienced the Lord ( or God or Brahma as Arjuna has )can do is use faint and poor methaphors and imagery in the hope of "hitting" some nerve in the reader - a nerve of recognition.
All humans ( all living beings really, but why start a fight ) are "separated from God" ( please forgive my christian imagery - it is the culture I grew up in ) not by any arbitrary rule or law ( dharma is often expressed as some sort of divine law ) but by the basic desire for distinction.
We all are so full of ego that we feel a need to be different from and separate from God. Each of us could, at any time, give up this need for ego ( separateness, individuality, personality, physical experience )and directly "translate" to co-mingling, joining, God. The ONLY thing that prevents this full and complete union with God is our desire to be different and separate from "him". This is, in fact, why some people seem to "just die" without any reason. They may have not had the "right reasons" but they did eventually get to that psychological state where they no longer "held onto" life.
One thing that the Bhudda saw ( that is missed by most christians - even the mystics ) was that this desire and the attendant process of eliminating this desire is not a struggle that is "decided", finally, at death. We can, if we are so "foolish" continue on through "the infinite universe and for all time". Ego is this strong.