The experiment was not ethical as Milgrim did not obtain informed consent from his participants. This is required as all members taking part in an experiment must be aware of all aspects since they may not be comfortable taking part in certain activities. This was the case in the laboratory experiment as some participants experienced stress to such a degree that they broke into nervous laughter and even seizures. If the participants had been told beforehand what the experiment required of them, such negative reactions may not have occured. However, this was a key part of the experiment and thus, potentially, a necessary evil.
Another unavoidable ethical choice was deception. The participants believed that they were taking part in a memory test, and then that they were truly electrocuting another person to the point of unconsciousness or death. Despite being given the right to withdraw, they were provided with verbal prods four times if they asked to leave, not being allowed to do so until the fifth time. This would have made them feel as if they had no choice but to continue, which could arguably mean that they did not have a real right to withdraw - it was not explicit enough.
On the other hand, all participants were debriefed at the end of the experiment, which is an important factor when deception is a necessary part of the study. They most likely had the option to withdraw their data from the experiment after this debriefing if they felt uncomfortable after said deception and the potential mental damage caused as a result of what they believed they had been doing.