Dharma means the natural order of something. Its etymology is derived from the root ‘dhr’ which means to uphold or sustain something. In other words dharma is the beingness of something, the unique characteristics without which it cannot exist. For example the dharma of fire is said to be to burn and heat, if one were to take out burning or heat from fire, fire would cease being fire. The dharma of a king is to rule, if one takes rulership from the king, the king would cease being a king. Its origins can be traced to the Rig Veda, where the concept of Rta as a comic ordering principle is first mentioned.
In the Bhagvad Gita dharma is defined as ones specific duties which can either by defined by ones class(varna), ones role in a relationship, ones gender, and even ones species. In traditional Hindu society upholding dharma is considered to be a moral imperative. In the Bhagvad Gita Krishna instructs Arjuna to do his warrior dharma, defining his individual dharma or svadharma as protecting his citizens and fighting to maintain righteousness in society. He further says that the very cause of the destruction of the order of any society is when people fail to carry out their dharma properly or take on the dharmas they are not suited to. It is better, says Krishna, to do ones dharma imperfectly, than to do anothers perfectly.
In the Hindu philosophical school Vaiseshika founded by sage Kananda, dharma is defined as the properties of matter. The opening sutras of the Vaiseshika sutra explain its philosophical project is to classify all matter in existence by their particular properties(vaisesa)
In modern spiritual parlance dharma is defined as ones unique life purpose that one must realise by tapping into their being and finding how the unique talents and passions they have that can contribute to the betterment of the world. The concept is central to the writings of new-age spiritual writers like Deepak Chopra(7 spiritual laws of spiritual success) and Robin Sharma(The Monk who sold his Ferrai)