I have two switches, and both are associated with the same Nintendo account which is linked to a Nintendo services online account (it is a family account, not sure that matters if the switches are both tied to one Nintendo account, but my family account includes my husband, mother, and close friends as well, did it just get it for the second switch). Both islands can play online and interact with others - for example I have friends who are on my friend list for both islands.
my two islands cannot friend each other, because they are the same account but the two characters can visit each other through local play and exchange items that way.
with a digital copy of the game, two switches can share the same copy if they are both attached to the same account, the secondary device just has to periodically be able to connect to the internet, to verify it is authorized to play the game.