How to control physical buttons
Is there any IC that can make contact between any PIN, like keyboard
  does?


You could use what is know as an analogue cross-point switch: -



The above is the block diagram of the MT8809 made by Microsemi. It basically works like this: -



You could make it from analogue switches also. Before the full digital revolution these types of devices replaced the old strowger relays used in telephone exchanges - basically 8 telephone lines can be routed to 8 other lines thus a massive matrix was built to form a telephone exchange.

ADI make one too: -



They also make an 8x8 type called ADG2188. See ADI's offerings here