The actual source is unknown, and although this expression was first recorded in America (1839), it's thought to be of older, English origin. Wool here is the hair of wigs. In the 19th century, the status of men was often indicated by the size of their wigs - hence our word bigwig to indicate importance.
Judges often wore these poor-fitting wigs, which frequently slipped over the eyes, and it may have been that a clever lawyer who tricked a judge bragged about his deception by saying that he pulled the wool over his eyes. Such bigwigs were worth robbing.
Street thugs would pull the wig down over the victims eyes in order to confuse him - the wool had been pulled over his eyes.