It's legal, although on the borderline in terms of ethics.
Methadone is a respiratory depressant, and as such can cause death. There is a loophole in the confidentiality laws that provide an exception whenever there are "life threatening" circumstances.