Disciplining of the body in the Hindu and Buddhist religious traditions are intended to keep the body fit, as well as to help the soul, which is considered to be separate from body, to gain independence from body. It is argued that in the relationship of the body and the soul, the soul is the master, which is expected to use the body as an instrument or a tool for its advancement towards the ultimate happiness. However the soul in ordinary people forgetting its true potential and power, becomes a slave of the body. As a result the soul identifies itself with pain and pleasures of the body. But the real happiness of soul lies not in the pains and pleasures the physical world experienced by the body, but by being liberated from the bondage of the body and the world.
The disciplining of the body by various means like yoga, which is essentially a system of bodily exercises, helps to make body fit for performing various bodily functions. It also helps the soul to learn to accept pain and pleasure of the body with equanimity, and thus break away from its preoccupation with such pain and pleasure. This is supposed to, ultimately, lead to soul realizing its true nature in a process which is likened to a person waking up from sleep ceasing to feel the pain and pleasures felt in dreams. This realization by soul is enough to release it from the bondage of the body and make it master rather than slave of the body. The enlightenment of Buddha, under the banyan tree, which earned him the title of Buddha, meaning the enlightened one, refers to such liberation of soul from the bondage of body.
Now, that I have given the example of enlightenment of Buddha, I must clarify that it is only one in millions of people who attain this kind of enlightenment. But even those, who do not achieve final enlightenment, do become more peaceful, contended, and happy by disciplining their bodies in the right way.