I seek more details and other opinions than Cerberus's answer that cited Lewis & Short on what notions underlie folding and replying.
As to why folding (back) came to mean uttering (back), I imagine the figurative sense "to roll something over in the mind" was expanded to rolling something over in a conversation, inspecting it by talking about it.
How can 'roll over in mind' broaden to mean 'roll something over in a conversation' then to 'reply'? I've never heard of the VP 'roll something over in a conversation' in English; it doesn't feel intuitive.
Etymonline proclaims that
replicare "to repeat, reply," literally "to fold back,"
p 1785 on Oxford Latin Dictionary (2012 2 ed) doesn't expound the semantic shift. I marked the entry with a red line.