Pumpkin carving being associated with Halloween comes from a method used by the Celts to ward off evil spirits during Samuin (a festival where many of the traditions of Halloween come from). The Celts would hollow out turnips, then carve faces in them and place candles inside. The turnips were then either placed in the windows, to keep evil spirits from entering a home, or carried around as lanterns.
This tradition eventually melded with the North American tradition of carving pumpkins. At this point, the carving of pumpkins, which had been around in North America before Halloween was popularly introduced, became associated almost exclusively with Halloween (around the 19th century).
Source from Today I Found Out