The king made the order because of fears over Mr Rajab's health, it said.
An appeals court in May upheld the six-month prison sentence he had received.
He is a member of the island's Shia majority who has served several prison sentences since setting up the Bahrain Centre for Human Rights in 2002.
Mr Rajab was arrested in April and charged with insulting public institutions on Twitter.
Bahrain's Sunni Muslim rulers forcibly quelled a 2011 uprising which had been triggered in large part by unrest among Shias.
Mr Rajab also fell foul of the authorities in September after suggesting in a tweet that security institutions in Bahrain served as an "ideological incubator" for jihadists.
Human rights groups described his arrest and conviction as developments which should give the US pause for thought as it considered whether to lift restrictions on sending arms to the kingdom.
In June US State Department spokesman John Kirby said that Bahrain's progress on human rights, including the release of political prisoners, meant that Washington would resume aid to the military in Bahrain.
Shia-dominated demonstrations against Bahrain's Sunni monarchy have occurred sporadically since 2011.
Dozens died when the government moved to quash the protests.
Bahraini human rights campaigner Nabeel Rajab has been pardoned by King Hamad after serving three months of a six-month jail sentence,  the official BNA news agency has reported.