from where has it evolved?
The concept of "moksha" appears much later in ancient Indian literature than the concept of "dharma"
Moksha
The concept of "moksha" appears much later in ancient Indian literature than the concept of "dharma". 
what is the meaning of yoga in hinduism The term "Yoga" in the Western world often denotes a modern form of hatha yoga and yoga as exercise, consisting largely of the postures or asanas what is its goal? The ultimate goal of Yoga is "Moksha" what is meant by this last term? Moksha also called vimoksha, vimukti and mukti, is a term in Hinduism, Buddhism, Jainism and Sikhism for various forms of emancipation, enlightenment, liberation, and release
wiki:5245280
Moksha [SEP] History
The concept of "moksha" appears much later in ancient Indian literature than the concept of "dharma". The proto-concept that first appears in the ancient Sanskrit verses and early Upanishads is "mucyate", which means freed or released. It is the middle and later Upanishads, such as the Svetasvatara and Maitri, where the word "moksha" appears and begins becoming an important concept. Kathaka Upanishad, a middle Upanishadic era script dated to be about 2500 years old, is among the earliest expositions about "saṃsāra" and "moksha". In Book I, Section III, the legend of boy Naciketa queries Yama, the lord of death to explain what causes "saṃsāra" and what leads to liberation.