Bunyan began the work while in the Bedfordshire county gaol for violations of the Conventicle Act, which prohibited the holding of religious services outside the auspices of the established Church of England. Early Bunyan scholars like John Brown believed The Pilgrim's Progress was begun in Bunyan's second shorter imprisonment for six months in 1675, but more recent scholars like Roger Sharrock believe that it was begun during Bunyan's initial, more lengthy imprisonment from 1660-1672 right after he had written his spiritual autobiography, Grace Abounding to the Chief of Sinners.
The English text comprises 108,260 words and is divided into two parts, each reading as a continuous narrative with no chapter divisions.
The first part was completed in 1677 and entered into the stationers' register on December 22, 1677. It was licensed and entered in the "Term Catalogue" on February 18, 1678, which is looked upon as the date of first publication. After the first edition of the first part in 1678, an expanded edition, with additions written after Bunyan was freed, appeared in 1679. The Second Part appeared in 1684. There were eleven editions of the first part in John Bunyan's lifetime, published in successive years from 1678 to 1685 and in 1688, and there were two editions of the second part, published in 1684 and 1686.