A prison officer will be killed if the government does not get a grip following recent attacks, the shadow justice secretary said.