Hundreds of captives who were beaten, abused and held in squalid conditions at a purported Islamic school in northern Nigeria escaped prior to a raid this week, police said on Tuesday.