Separation of powers means that the judiciary can't pass laws or executive orders. It doesn't mean that the judiciary can't interfere with their passage and enforcement. Quite the opposite -- the checks and balances inherent in the system ensure that the judiciary can interfere in some cases.
One of the checks is the concept of judicial review: the courts' power to review each branch's actions for compliance with the constitution -- and more importantly, to strike down actions that are unconstitutional. When a court strikes down part of a law, though, they aren't writing a new law, or even repealing a law. They are overturning parts of the existing law -- basically declaring the unconstitutional parts of it void, to be treated as if they didn't exist.
In India's constitution, Article 13 provides the main basis for this power. Article 13.(2) (in Part III) states:
(2) The State shall not make any law which takes away or abridges the rights conferred by this Part and any law made in contravention of this clause shall, to the extent of the contravention, be void.
This article, aside from making it clear that laws passed by the State can be void, also gives the Supreme Court the inroads it needs to do the overturning. The catch is, the Court can not overturn most laws passed by Parliament, just the ones that Part III can be construed to prohibit.
(While the judiciary is not explicitly named, it's the only branch that can officially say whether or not a law is constitutional. It'd be a conflict of interest anyway for Parliament to do it. Parliament, in passing the law, presumably wanted it to be enforced, and thus has an interest in avoiding too much scrutiny.)
So the Court can already declare an unconstitutional law void, because it already is...and that's before we even get to Article 142.
Let's take a look at the article anyway:
(1) The Supreme Court in the exercise of its jurisdiction may pass such decree or make such order as is necessary for doing complete justice in any cause or matter pending before it, and any decree so passed or order so made shall be enforceable throughout the territory of India in such manner as may be prescribed by or under any law made by Parliament and, until provision in that behalf is so made, in such manner as the President may by order prescribe.
(2) Subject to the provisions of any law made in this
behalf by Parliament, the Supreme Court shall, as respects
the whole of the territory of India, have all and every
power to make any order for the purpose of securing the
attendance of any person, the discovery or production of
any documents, or the investigation or punishment of
any contempt of itself.
Note that (2) explicitly grants the power to issue subpoenas, contempt citations, etc. So we can't claim that's what (1) was intended for, and have to ask what it means.
The Court decided that the article gives it the power to order the government not to violate your rights, as such an order is "necessary for doing complete justice". And as the final arbiter of the meaning of the very text that defines it into existence, it has that prerogative.
And due process is one of the rights protected. Article 21 (also in Part III):
No person shall be deprived of his life or personal liberty except according to procedure established by law.
"Procedure established by law" is a much weaker phrase than "due process", and technically meant that anything that the government scribbled into law was good enough. But case law has all but removed the distinction. (See Maneka Gandhi vs Union Of India.) Basically, any procedure for depriving someone of life or liberty must be just, fair, and reasonable. (Otherwise a law declaring you a criminal, to be arrested on sight, would be constitutional.) "Someone filed a complaint" simply wasn't gonna fly.