How did 'folding back' semantically shift to mean 'reply'?
Etymologically, reply means ‘fold back’. It comes ultimately from Latin replicāre ‘fold back, unfold’, a compound verb formed from the prefix re- ‘back’ and_ plicāre_ ‘fold’ (source of English ply and related to English fold). This came to be used metaphorically for ‘go over again, repeat’ (whence English replicate ), and also as a legal term for ‘respond’. In this latter sense it passed into English via Old French replier.
Word Origins (2005 2e) by John Ayto, p 421 Right column.
p 1785 on Oxford Latin Dictionary (2012 2 ed) doesn't expound the semantic shift. I marked the entry with a red line.