To get light and dark hearts, you need to leave a gift on a friend's island, which you can find in the game under the "Gifts" tab when visiting a friend. 
 
Also, depending on which hearts you need, you can choose the "Light" or "Dark" tab in the Gifts menu.