No, it is not necessary for the charged body to actually touch the ball of an electroscope.
Work Step by Step
You may want to refer to Figure 22.13. If, say, a positively charged object is brought near the ball, some electrons from the leaves are attracted up into the ball, leaving the gold leaves with a net positive charge. The leaves will spread apart. A similar argument explains why the leaves will spread apart when a negatively charged object is brought near the ball. This is an example of charge separation due to induction.