A British-Egyptian activist who has spent years in prison has been pardoned by Egypt's president, according to his lawyer.