"Pair" is a homophone of "pear". An apple is a fruit, and a pear is a fruit. The joke is in the dual meaning of "the pair beneath it". That could refer to a pair of apples, or it could mean the fruit pear as "pair" sounds like "pear". 
It wasn ’ t the apple on the tree , but the pair beneath it .