Yes, you can do this with GraphHopper. First you need to find the coordinates of your locations. This is called geocoding and is described here: Documentation - GraphHopper Directions API
Once you got the GPS coordinates of all your locations you can calculate the distances using the Matrix API: Documentation - GraphHopper Directions API
Also make sure to read the documentation for general usage of the GraphHopper APIs: Documentation - GraphHopper Directions API