"For the older writer, memory and the imagination begin to seem less and less distinguishable. This is not because the imagined world is really much closer to the writer's life than he or she cares to admit (a common error among those who anatomise fiction) but for exactly the opposite reason: that memory itself comes to seem much closer to an act of the imagination than ever before."
Julian Barnes (2008), Nothing To Be Frightened Of (p. 238, paperback edition)
Think of the last time someone annoyed you. If you're like me you might replay the scene over in your mind. You might think of different things you might have said, how you could have got your own back on the person, or conversely how you could have responded with a greater level of calm. This kind of counterfactual thinking is useful in that it can prepare us to respond better if/when such events re-occur. Memories from our past can thus be tied up with how we think about our future.
As I'm planning a new project examining autobiographical memory, I recently picked up a really interesting book on Understanding Autobiographical Memory. One chapter in particular (see reference below) takes a rather interesting perspective on the connections between memory and future thinking. D'Argembeau highlights an interesting case study of a patient who lost not only his ability to remember past episodes from his life, but also to imagine his future; he described his attempts to engage in either form of thinking as leading to a mental blankness.
This is a rather extreme case that may be difficult for the average person to imagine, but in general both autobiographical memory and thinking about the future can be described as forms of "mental time travel" (imagining oneself in a different time, offering oneself the possibility to experience now what one is not experiencing directly from the present moment). They can both draw upon similar knowledge structures in the mind such as episodic detail or social scripts. For example, your knowledge of what happens in a job interview helps both to delineate what did and did not occur during a past job interview (e.g. bumping into one of the interviewers beforehand was not part of the interview, or so you hope) and to think of how to be more successful in similar situations in future (e.g. by responding to a type of question differently). A difference between the two forms of thinking is that spontaneous thoughts about the future tend to be more generic than their remembered counterparts. However, people may draw upon autobiographical memory in order to "flesh out" more generic thoughts of the future with episodic detail.
An interesting meta-analysis has suggested that a network of brain regions is activated during both autobiographical memory and thinking about the future, in addition to other forms of complex cognition such as theory of mind. Perhaps there is some connection here with creative thought; even though autobiographical memory does not and future thinking about oneself typically should not concern fictional events, both could be described as a forms of imagination. As Ruth Byrne has suggested, counterfactual thinking can be a form of creativity, and when this is applied to our own autobiography, the work of fiction can be how our own pasts may have played out.
D'Argembeau, A., 2012. Autobiographical memory and future thinking. In D. Berntsen & D.C. Rubin (Eds.), Understanding autobiographical memory: Theories and approaches, pp.311-330. Cambridge: Cambridge University Press.