Does a plant have to have leaves to produce fruit?
In short: yes, a plant have to have leaves to produce a fruit. Both from the evolutionary viewpoint as from the anatomical viewpoint.

All the fruit producing plants belong to a group we call Anthophyta (or Magnoliophyta), meaning in greek "plants with flowers". These fruit producing plants are all descendant from ancestors that have leaves, specifically what we call megaphyll ("big leaves").

Even Anthophyta that apparently stopped producing leaves, as cactuses, still have them. According to Mauseth (Botany: An Introduction to Plant Biology):


  Although all flowering plants possess leaves, stems and roots, these parts have been modified so extensively in some species that they may not be recognizable without careful study. For example, cacti are often described as leafless, but they actually have small green leaves between 100 and 1000 micrometers long.  


More important, spines are highly modified leaves (and that's the difference between spines and thorns). In a cactus, these highly modified leaves come from a structure called areole, that also produces another highly modified leaf: the flower.

Now to the anatomical part: flowers are specialised leaves:


http://www.ncbi.nlm.nih.gov/pubmed/11440721 
http://www.scielo.br/scielo.php?script=sci_arttext&amp;pid=S1677-04202005000400001
http://dx.doi.org/10.1016/S0960-9822(01)00024-0
http://www.ijdb.ehu.es/web/paper/052020pr


...and the list continues. According to Lodish, "Molecular Cell Biology" (http://www.ncbi.nlm.nih.gov/books/NBK21561/):


  Genetic studies have shown that normal flower development requires three classes of floral organ – identity genes. In plants with mutations in all three classes, concentric whorls of leaf-like structures replace the floral organs, indicating that these structures are modified leaves. (emphasis mine)


And according to Durner, "Principles of Horticultural Physiology":


  Flowers are modified leaves. Upon exposure to specific environmental signals such as daylength or temperature or at a specific point of plant development, shoot meristems start to form flowers rather than leaves. (emphasis mine)


And from a paper published in Nature, 2001 (http://www.nature.com/nature/journal/v409/n6819/full/409469a0.html):


  Goethe was right when he proposed that flowers are modified leaves. It seems
  that four genes involved in plant development must be expressed together to
  turn leaves into floral organs. (emphasis mine)


Flowers have several parts, and one of them is the ovary, which will turn into the fruit after (but not necessarily) the fecundation. Thus, in conclusion, fruits are a modified part of a flower, and flowers are specialised leaves.

It's worth mentioning that all fruit plants have leaves, but of course not all plants with leaves have fruits.