In a word, no. Malcolm's addiction was to heroin and while there's a statistical medical risk associated with opioid withdrawal, the reality is that someone in otherwise good health with no underlying heart conditions, with no associated psychological disorders and who isn't abusing any other substances would be highly unlikely (fractions of a percent) to suffer from a withdrawal side-effect that was deadly.
Referring to the excellent "Drugs of Abuse and Addiction: Neurobehavioral Toxicology" by Niesink, Jaspers, Kornet and Ree
"[Heroin withdrawal] is time limited … and not life-threatening, thus can be easily controlled by reassurance, personal attention and
general nursing care..."
Added to this is the fact that his condition was monitored by his friends (who were apparently providing him with food and drink to prevent dehydration) and his percentage chance of actually dying drops to an almost statistically insignificant percentage of risk.
As to why his detox was portrayed as it was, within the show, we can see that the actor (Eka Darville) watched a number of videos of heroin users taking themselves through withdrawal in order to prepare for the role so he and the filmmakers would have been very aware that medical intervention isn't actually a necessity.
Malcolm suffers from drug addiction. Part of the prep for a character who's going through that kind of experience with drugs, and in
particular heroin, is understanding the psychology behind that
addiction and how it plays out in people's lives. I did a lot of
research. I watched every dude on YouTube filming themselves going
through detox. It's a weird and dark little corner of the internet,
and I spent a lot of time going there. The most interesting part is
the bargaining and the denial, and just the degree of self-talk and
psychosis that goes into convincing those people around you that
you're fine. There's very definitive behavioral things that come along
You may wish to note that other shows (such as The Wire) have shown medically-supported detox so it's unlikely that there are specific laws that prevent this.