Judge Kiyo Matsumoto said a Facebook post in which Shkreli offered $5,000 for a strand of Hillary Clinton's hair showed he was a danger to the public.
The former CEO, 34, had been free on $5m (£4m) bail since his 2015 arrest.
Shkreli was branded "the most hated man in America" when his firm hiked the price of medication for Aids patients.
In August 2017 he was found guilty of three counts of securities fraud by a New York City jury, which cleared him on five other counts.
Shkreli was on trial in relation to a drug company he previously headed, Retrophin, and a hedge fund he managed.
On Wednesday, Judge Matsumoto ruled that Shkreli's post on 4 September - made shortly before Mrs Clinton began a book tour - showed he posed a danger, rejecting arguments his words were protected by US free speech laws.
Shkreli - who has clashed frequently with critics on social media - had argued that the since-deleted post amounted to satire, and had been a reference to DNA sequencing.
"This is a solicitation of assault in exchange for money," the judge said. "That is not protected by the First Amendment."
Shkreli's lawyer Benjamin Brafman said: "We are obviously disappointed.
"We believed that the court arrived at the wrong decision. But she's the judge, and right now we will have to live with this decision."
Shkreli rocketed to notoriety in 2015 - and earned the nickname "Pharma Bro" - after raising the price of a lifesaving anti-parasite drug called Daraprim by 5,000% upon acquiring rights to the medication.
Overnight, the price of the drug soared from $13.50 to $750 (£570) per dose.