Bishop Atterbury's 'poor soldier' was the royalist commander Sir Jacob Astley, and his prayer was offered up before the battle of Edgehill (1642), in which he was wounded. Atterbury had almost certainly come across the story in the Memoires (1701) of Sir Philip Warwick, whose version of the prayer is even more moving:
`O Lord! thou knowest how busy I must be this day: if I forget thee, do not forget me.'
Note from Bishop Francis Atterbury, from Literary Anecdotes