I believe baptism by immersion in water in the name of Jesus or in the name of the Father, the Son, and the Holy Ghost is necessary for salvation. Mark 16:16.
So how do those imprisoned whether man or angel get baptized? They must ask. Ask their jailer. Ask the warden. Ask.