Aryan Khan, 23, the eldest son of the actor dubbed the “King of Bollywood”, was detained in early October alongside 19 others after the Narcotics Control Bureau raided a ship set to sail from Mumbai to Goa.
He was given bail Thursday along with two others by the High Court of Bombay on their fourth attempt.
He would likely be released on Friday or Saturday, his lawyer and India’s former attorney-general Mukul Rohatgi told reporters.
The case has grabbed headlines across India, dominating front pages and receiving non-stop coverage on news channels.
Some have claimed that Khan, a Muslim, is a victim of religious persecution in a country governed by a Hindu-nationalist party.
Social media has been flooded with messages of support for the family, with many calling the arrest a witch-hunt.
Fans gathered outside the elder Khan’s seaside mansion in Mumbai to show solidarity and the family have also received support from several Bollywood A-listers.
The officer investigating the case, Sameer Wankhede, is facing an internal probe within the narcotics bureau and another by Mumbai police over allegations of bribery and extortion related to the case.
Rohatgi told the court Aryan Khan should be granted bail as no drugs were found in his possession and prosecutors had no proof of any consumption.
The narcotics agency opposed bail, arguing that the investigation revealed an international drug connection and had found drug-related WhatsApp chats on his phone.
The high-profile case comes a year after the suicide of Bollywood actor Sushant Singh Rajput and the arrest of his ex-girlfriend, actress Rhea Chakraborty, for allegedly buying him drugs.
Her arrest sparked a wider probe into drug use in Bollywood, with superstar Deepika Padukone and others hauled in for questioning.
Shah Rukh Khan, whose career spans three decades, is arguably Hindi cinema’s biggest and most recognisable star of the modern age