Most webmail providers offer an option to export the contacts for backup purposes.
Your application would need to ask for the user's credentials, then it could fetch the contact backup (I suppose it has a more or less generic URL) and parse it.
It will most likely be some form of xml or widely used abook format, both formats meant to be machine readable.
Edit:
For Gmail the url is http://mail.google.com/mail/contacts/data/export
, it accepts various parameters to define the format of the exported file (gmail csv, vcard, ...) and the scope of exported contacts.
To use it, your application would have to act as a http client and first have to login using the user's credentials.