How do gift cards get activated at the register?
The gift card stores the gift card account number on it (and some other verification information).
When the card is "activated", the register transfers this account information to the payment processor that communicates it back to the gift card issuer. The gift card issuer then updates their own database to indicate that the account can now be used. If someone tries to use a card that has not yet been activated, then the card issuer sees in their database that the card isn't active and sends a "rejection" message back through the payment processor. If someone uses a card that is active, then the issuer updates their database with the new balance.
How hard is it to implement or get encoding in order to work with all POS that take visa/MC?
You would either need to start your own payment processing company and get contracts with individual merchants to process payments for them (and then write the software to interface with their POS), or you would need to get a contract with a payment processing company and have them submit the information to you so you can maintain all the card accounts. Getting such a contract would at a minimum require significant audits, and proof that your system has met all the requirements of PCI compliance.