Dharma, artha, kama and moksa are the four purusarthas, the four aims of life. The first of them, dharma, is a lifelong objective. The pursuit of artha (material welfare) and kama (desire, love) must be given up at a certain stage in a man's life. But so long as such a pursuit lasts, it must be based on dharma. When a man renounces the world and becomes an ascetic, he transcends dharma, but he does not go contrary to it nor speak against it. Indeed, his life is governed by the dharma of sannyasa.
I have alreAdy spoken about Purvamimamsa (karmakanda) and Uttaramimamsa (jnanakanda). The Purvamimamsa-sutra opens with "Athato dharmajignasa", meaning "starting the inquiry into Dharma". The "Uttaramimamsa-sutra" (or Bramhasutra), on the other hand, starts with "Athato Bramhajignasa", "meaning"starting the inquiry into the Brahman".
When you inquire into the Brahmin and meditate on it you are not conscious of the Dharma. Dharma is for the dualistic world of karma. Since the phenomenal world does not exist in non-dualistic jnana there is no consideration of dharma in it. But this does not mean that[non-dualistic jnana]is contrary or opposed to dharma; and all that is meant is that it goes beyond dharma. Bhagwan declares in theGita: "Sarvadharman parityajya mam ekam saranam vraja" (Forsaking all dharmas come to me alone for refuge). Are we to construe that the Lord asks us to go to him for refuge as perpetrators of adharma? The true meaning of the words of the Lord is this: "Give up all inquiry into dharma and adharma. Go beyond them and comprehend the Object that is the source of both". What is sought is an inward experience. The actions performed by the jnanins who have their inner realisation will naturally be in conformity with the dharma. The doings of the high-souled ascetics may not be consciously based on dharma, but, nevertheless, they would be nothing but dharmic.
All told, dharma is always a part of man's life. When he reaches a high spiritual state, he may not be conscious of it, but dharma will abide him and will keep shining as a light in all that he does.
The pursuit of the second of the four aims of life, artha, must be based on dharma. The same applies to the third aim, that of kama. Kalidasa expresses the same thought in his Raghuvamsam when he speaks in praise of Dilipa: "Abhyarthakamau tasyastam dharma eva manisinah" (With Dilipa, the wise, even artha and kama were of the nature of dharma). The householder's stage of life commences with marriage. In it both material well-being and desire have their source in dharma. The student-bachelor and the ascetic are not concerned with the acquisition of wealth or carnal pleasure. The householder's stage of life, or, grhasthasrama, is a bridge between the two and in it both are permitted [within the bounds of dharma]
A man needs money and material goods to live in this world. As for kama or carnal desire, it is needed so that children may be born according to their past karma. Until we have lived out our karma we too will have to be in this world. In this way if we want to give a "chance" to others, we have to earn money and experience kama so that they [these others] may be born again. We need householders to feed sannyasins who have given up karma. It would not be practical for all people in this world to become ascetics. The sastras extol householders as the backbone of the society since they live, or are expected to live, according to the dictates of the dharma and fulfil the requirements of student-bachelors and ascetics.
After completing one's student-bachelorhood and acquiring learning and good qualities, one must marry so as to perform religious rites and live a life guided by dharma. Marriage is included among the forty samskaras, which fact shows that it is a sacred rite that sanctifies life. Just as upanayana is preliminary(purvanga)to the student-bachelor's stage of life, marriage is preliminary to that of the householder. Its purpose is disciplining the senses and the basis for the performance of various duties.
The householder's life is not to be taken to mean merely the enjoyment of sensual pleasure along with the carrying out of duties that mean good to the world. The fact is that the sastras have formulated this stage of life in such a way as to make kama itself instinct with dharma. "Dharma" means essentially bringing everything within certain limits, under a certain discipline and decorum. Kama must be inspired by dharma, that is one must bridle one's passions in one's conjugal life, so that, step by step, the carnal urge will lose its keenness and eventually one will gain mellowness to graduate to sannyasa. That stage, though, comes later. But at first, even now, in the householder's stage of life, the passions have to be curbed, little by little, but not forcibly. In the gurukula the celibate-student is brought under strict discipline. That saves him from being swept away by animal passion.
Though we talk of animal passion, we must note that animals mate only during a particular season. They have the sexual urge only when the female of the species is ready for pregnancy. Man is baser in such matters. Brahmacarya helps to control the carnal urge as it first shows up. Then, in the householder's life, since kama is made subservient to dharma, the passions are kept under check.
What is the sastric method to control the carnal urge? From the day of a women's period there should be no intercourse for four days. Then it is permitted for twelve days. Again there should be no intercourse until the women has her next period. Even during the twelve days mentioned above the couple should not meet during the new moon, on days conjoined by certain asterisms, etc., If such rules are followed the couple will remain healthy mentally as well as physically.
For a general background, please see here