I have read the answers for this question. But all the answers are talking of just one point of view i.e of Sankara. No one has even bothered to talk from the queen's point of view who was used in this whole act.
People should understand that criminal and jnani are antonyms. An enlightened person cannot be a criminal and vice versa. If someone commits a crime then be assured that he is not a jnani. Nowhere in the whole history has some enlightened person has ever done such thing.
The self is not affected by anything. But when such wicked thoughts arise in the mind it clearly shows that one is not yet realized. The samskaras stay with the astral body and continue to cling even after death. As these experiences were registered in his chitta. he was able to recollect them after coming back to his body.
Sankara makes it clear that he is entering the body in order to win the debate and achieve the title of Jagatguru or Sarvajna.
Canto 9 of Madhaviya Shankara Digvijaya records this incident.
Shankara decides to enter the body of King as:
Sankara said to his disciple Padmapada "Here lies dead the renowned.
king Amaruka, having more than a hundred wives of exquisite beauty. I
am thinking why I should not enter into the body of this king and
revive it by Yogic power, and thus live in his palace amidst these
women through his body in order to gain knowledge of sex-love and
achieve the status of an all-knowing person.
Some wise men here have also equated this act with that of Indra and Gods killing of Demons. But how on earth does it become mandatory to defeat a Vaidika as equal to killing of a demon? Indra and gods have their duty to kill demons and protect pupil. Was it duty of sankara to go against vaidiks ? instead he should have defeated the buddhists or jinas.
Second point raised by people is that Atma does not get any sin. This is already known to everyone. But here we should understand that physical body also DOES NOT get any sin. The sin is to the one who is operating the body. The body is only an instrument. If I enter some dead body and perform a murder then who will get the Sin? Definitely the one who is using the body. As King had already left the body he will get no sin for this whatsoever. The who act did not involve atma which is accepted but it did involve the mind and intellect etc. This is why Sankara was able to recollect the experiences even after returning back to his body.
The wife was a victim here who was not aware of such deceitful ideas that someone else is operating through her husbands body. What if she had became pregnant out of this Vyabhichara? whom will you hold responsible for such adultery ? King amaruka or the queen? The son will be of Sankara and the queen as the sastras declare
"angad angat sambhavasi hrdayad abhijayase atma vai putra-namasi
sañjiva saradah satam"
“You have taken birth from my various limbs and have arisen from my
very heart. You are my own self in the form of my son. May you live
through a hundred autumns.” This verse appears in the Satapatha
Brahmana (184.108.40.206) and the Brhad-aranyaka Upanisad (6.4.8).
It was for the motive of achieving the title of Sarvajna and not for killing any demon nor for the good of the King or Queen. Hence it was a selfish deed.
Further, Sanyasa does not allow anyone to have intercourse once the sanyasa is taken up. If someone MISUSES his yogic powers and uses another body then it is like making a mockery of such rules.
By no means it is allowed to use something in an illegitimate manner for self benefit or learning. No one can say that "I want to learn Kamashastra so I am using someones body and cheating his wife". If at all someone wants the learn then he may visit a worker or after getting agreement from the opposite person. Else the only way is to take up grihastha ashrama and understand the conjugal bliss.
It was not mandatory to do such act. No one was going to murder him if he didnt win the debate. He could have resigned from the debate by saying that I am not eligible for these questions as i m a brahmachari/sanyasin. Had she asked about robbery then would sankara become a theif to learn it ? it is completely illogical. He could have also called off the debate or cursed the opponent for asking such wrong questions to a sanyasin.
but it was completely wrong on the side of the queen. she did not deserved to be cheated for someone's personal motive. This whole incident can be equated to adultery.
Mandana mishra and his wife were ardent followers of Vaidika dharma. What harm would they do to hinduism? Why was it as important as killing of demon by gods ?