The Book of Revelation was written around 68-69 AD by the Apostle John on the Island of Patmos after the Emperor Nero exiled him for preaching the Gospel of Jesus Christ. There is some speculation that Emperor Domitian was the one that sent John to Patmos, but some evidences say otherwise.
It's really impossible to know exactly when John wrote 'The Book of Revelations'. Some surmise that it was done sooner than 69 AD, some later. Some even surmise that John wrote this Book around 43AD.
When you read Revelation, nowhere in the book does it state that John is in exile or imprisoned. He states that he is there for the Gospel. The tradition of John's exile was started by Augustine about 200 years after John lived. It appears that Revelation was written between A.D. 43-47. When was the book of Revelation written by the apostle John? - NeverThirsty