Oddly enough, the OED (1971 Compact Edition) has no entry for twig to, only for twig something:
twig v4 slang or colloq. [Origin unascertained]
b. To become aware of by seeing; to perceive, discern, catch sight of; to recognize.
1796 J. G. Holman Abroad & at Home iii. ii, ― He twigs me. He knows Dicky here in his real and masquerade character both.
1801 M. G. Lewis Tales Wonder, Sailor’s T. ii, ― With strange surprise and fear, Jack Tackle’s ghost I twigg’d.
1825 Lady Granville Lett. 30 Jan. (1894) I. 339 ― They have twigged me.
1860 Hunting Grounds Old World Ser. i. xii. (ed. 2) 189 ― The leader, whom at last I twigged lying down and chewing the cud.
1879 F. Pollok Sport Brit. Burmah I. 191, ― I twigged the tigress creeping away in front of us.
Still, that's clearly the same as twig to so it will serve. What is the origin of this expression? Neither the OED nor etymonline.com provide any etymological information for this meaning of the word twig. It occurred to me that it might come from a hunting/tracking analogy where the sound of a broken twig would alert the hunter to the presence of their prey or the prey to the presence of the hunter. Is there anything to this or am I making it all up?