This article explains how to export contacts from Yahoo Mail and Outlook.com and import them into Gmail.
How to Import Emails and Contacts from Other Accounts into Gmail
When you send an email, Gmail automatically remembers each recipient. These addresses appear in your Gmail contacts list, and Gmail automatically fills them in when you compose a new message.
However, you do have to enter the email address at least once. Is this really necessary, since all your contacts are already in an address book in Yahoo Mail, Outlook or Mac OS X Mail? No, because you can import addresses into Gmail from your other email accounts.
To import addresses into Gmail, you first need to take them out of your current address book and convert them into CSV format. While it sounds complicated, a CSV file is actually just a plain text file with addresses and names separated by commas.