A Dhaka magistrate gave the order, meaning the 24-year-old cricketer can be freed later Sunday or early Monday and join a practice session with the rest of Bangladesh's World Cup squad.
"The court has granted him bail until the end of the World Cup," Hossain's lawyer Moniruzzaman Asad told AFP, adding the order was granted in view of "national interest" since he has been a key player in the team.
The fast bowler was remanded in custody on Thursday in the latest twist to a sensational case over allegations that he raped Bengali actress Naznin Akter Happy.
Police last month launched a probe after Happy lodged a complaint that Hossain had backed away from an earlier pledge to marry her after a months-long "intimate affair".
The remand had placed a huge question mark over Hossain's appearance in the World Cup in Australia and New Zealand, beginning in the middle of next month, after selectors picked him in the 15-man squad.
Authorities had even lined up a replacement for Hossain with Bangladeshi courts rarely granting bail in rape cases until formal charges are filed.
But after Sunday's ruling, cricket chiefs heaved a sigh of relief.
"His tension is now over. He can join the practice with the World Cup squad from tomorrow," Akram Khan, the Bangladesh Cricket Board (BCB) head of operations, told reporters.
After hearing the complaint, a court ordered medical tests on Happy and told both the alleged victim and Hossain to undergo DNA tests.
The scandal has gripped the conservative Muslim-majority country for weeks, with Happy telling reporters she would withdraw the case if Rubel agrees to marry her.
Although victims of alleged rapes are entitled to anonymity, Happy's decision to go public prompted police to waive the usual restrictions.
The fast bowler has rejected the accusations of rape or making a marriage proposal, saying Happy was trying to "blackmail" him. He ruled out marrying the actress.
Happy became a household name for her debut movie "Kichu Asha Bhalobasa" (Some Hopes, Some Loves) which hit cinemas in 2013.
Rubel has played 22 Tests for Bangladesh and taken 32 wickets. He has also taken 69 wickets in 53 one-day international matches.
Like Sports on Facebook, follow @ETribuneSports on Twitter to stay informed and join in the conversation.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ