You cannot do this from the iPhone natively, however, if you log into your iCloud account via a computer, you can easily export your contacts. Follow Apple's instructions via the following link. Afterwards, you can email the file to gmail account and import it. The native Mail app on the iPhone should allow you to import the file into your contacts, but I recommend you import it while logged into your gmail account via a computer.