The deaths occurred Sunday at a prison in the coastal city of Machala, Ecuador, after “the detonation of an explosive device” outside, officials said.