Takshaka was king of Nagas and at the time of Mahabharata was fighting against Pandava, but why and how did Arjuna killed the innocent wife of Takshaka. How is it righteous to kill a woman according to Dharmashastras?
As I discuss in this answer, a king named Shwetaki once conducted a Yagna (fire-ritual) for twelve years, and having consumed all the ghee (clarified butter) that was offered into the fire, Agni the fire god felt lethargic. So he consulted Brahma, who told him to consume the Khandava forest and all its inhabitants, as described in this chapter of the Adi Parva of the Mahabharata:
O exalted one, thou hast eaten, for twelve years, a continuous stream of sacrificial butter poured into thy mouth! It is for this that illness hath seized thee. But, O Agni, grieve not for it. Thou shalt soon regain thy own nature. I shall dispel this surfeit of thine and the time for it is even come. The dreadful forest Khandava, that abode of the enemies of the gods, which thou hadst of old once consumed to ashes at the request of the gods, hath now become the home of numerous creatures. When thou will have eaten the fat of those creatures, thou shalt regain thy own nature. Proceed thither in haste to consume that forest with its living population. Thou wilt then be cured of thy malady.
Agni was initially unsuccessful in destroying the forest, but then Brahma informed him that the ancient sages Nara and Narayana, whom I discuss here, had reincarnated on the earth as Arjuna and Krishna. Now Arjuna and Krishna happened to be in the Khandava forest at the time, so Agni asked them for their help:
Then that Brahmana addressed Arjuna and Vasudeva of the Satwata race, saying, 'Ye who are now staying so near unto Khandava are the two foremost of heroes on earth. I am a voracious Brahmana that always eateth much. O thou of the Vrishni race, and O Partha, I solicit you to gratify me by giving me sufficient food.' Thus addressed by the Brahmana, Krishna and the son of Pandu answered him, saying, 'O, tell us what kind of food will gratify thee so that we may endeavour to give it thee.' The illustrious Brahmana, thus replied to, said unto those heroes who were enquiring after the kind of food he sought, 'I do not desire to eat ordinary food. Know that I am Agni! Give me that food which suiteth me. This forest of Khandava is always protected by Indra. And as it is protected by the illustrious one, I always fail to consume it. In that forest dwelleth, with his followers and family, a Naga, called Takshaka, who is the friend of Indra. It is for him that the wielder of the thunderbolt protecteth this forest. Many other creatures also are thus protected here for the sake of Takshaka. Desiring to consume the forest I succeed not in my attempts in consequence of Indra's prowess. Beholding me blazing forth, he always poureth upon me water from the clouds. Therefore, I succeed not in consuming the forest of Khandava, although I desire very much to do so. I have now come to you--you who are both skilled in weapons! If you help me I will surely consume this forest: for even this is the food that is desired by me! As ye are conversant with excellent weapons, I pray you to prevent those showers from descending and any of the creatures from escaping, when I begin to consume this forest!
Krishna and Arjuna agreed to help him, so as I discuss in this answer Agni got Varuna the ocean god to give them divine weapons including the Sudarshana Chakra and the Gandiva bow. Then Agni got down to the business of destroying the forest and its inhabitants, while Krishna and Arjuna helped make sure nobody put out the fire or escaped. As Agni mentioned, the Naga king Takshaka who lived in the Khandava forest was a friend of Indra, so Krishna and Arjuna single-handedly fought against the gods.
In any case, it was during this great battle that Takshaka's wife was killed. Takshaka was away at the time, but his wife and son were there. Takshaka's wife tried to take her son and escape, but she was killed by Arjuna, as described in this chapter of the Adi Parva of the Mahabharata.
When the sky above that forest was thus covered with the arrows of Arjuna no living creature could then escape from below. And it so happened that while that forest was burning, Takshaka, the chief of the Nagas, was not there, having gone at that time to the field of Kurukshetra. But Aswasena, the mighty son of Takshaka, was there. He made great efforts to escape from that fire; but confined by Arjuna's shafts he succeeded not in finding a way. It was then that his mother, the daughter of a snake, determined to save him by swallowing him first. His mother first swallowed his head and then was swallowing his tail. And desirous of saving her son, the sea-snake rose (up from the earth) while still employed in swallowing her son's tail. But Arjuna as soon as he beheld her escaping, severed her head from her body by means of a sharp and keen-edged arrow. Indra saw all this, and desiring to save his friend's son, the wielder of the thunderbolt, by raising a violent wind, deprived Arjuna of consciousness. During those few moments, Aswasena succeeded in effecting his escape.
By the way, Takshaka's son Ashvasena later tried to avenge his mother's death by helping Karna in his fight against Arjuna, as described in this chapter of the Karna Parva of the Mahabharata. And Takshaka himself killed Arjuna's grandson Parikshit, as described in this chapter of the Adi Parva of the Mahabharata.
In any case, Arjuna's justification for killing Takshaka's wife is the same as his justification for killing the other inhabitants of the Khandava forest, namely that he had promised to help Agni and that the inhabitants of the forest posed a threat to the gods. In fact that is why Brahma selected the Khandava forest in the first place. See my answer here for how evil the Nagas were.
Now as to your question about killing women, in this chapter of the Bala Kanda of the Ramayana, Vishwamitra explains to Rama that a Kshatriya is allowed to kill a woman if she is engaging in evil:
Compassion regarding the elimination of a female is ungermane, oh, best one among men, since a prince has to effectuate it intending the welfare of four categories of society.... To the nominee who bears the burden of kingdom this is the age-old duty, and hence oh, Rama, the legatee of Kakutstha, eliminate this infamy, as goodness is inevident in her, isn't it? Oh, Rama, the protector of people, we have heard that Indra once eliminated Manthara, the daughter of Virochana, when she wished to annihilate earth, haven't we? And Rama, once Vishnu wiped out even the wife of sage Bhrigu and sage Shukracarya's mother when she wished the world to become one without a governing factor, namely Indra.
By the way, it is because of the Khandava forest battle that Maya, architect of the Asuras, agreed to build the city of Indraprastha. So it's interesting to note that if Krishna and Arjuna had not helped Agni, Delhi would be a swamp today!