Nabeel Rajab, the prominent Bahraini human rights campaigner, who was in custody for months, has been released pending his trial.