He was beaten to death in prison.

The Kremlin's own "Human Rights council" came to that conclusion, as did just about everyone else.

"Shortly before his death, a prison doctor who complained that Magnitsky was acting irrationally summoned a team of eight guards, who handcuffed Magnitsky and took him to a small room, where a first aid unit was denied access, the report said."

“Additionally, there are grounds to suspect that Magnitsky’s death was the result of a beating,” it said."

https://www.reuters.com/article/us-russia-lawyer-death/russian-lawyer-likely-beaten-to-death-kremlin-council-idUSTRE76521120110706

Even Putin's propaganda arm reported that:

"The documents we possess testify to the illegal use of rubber clubs,” said council member and human rights defender Valery Borshchyov, as quoted by Interfax. “It turns out that 8 prison employees were beating one prisoner.”

https://www.rt.com/news/lawyer-magnitsky-tortured-probe-405