If you hover over the name of the setting in the project settings window, it will tell you the string/path needed to retrieve that value.
var gravity_vector : Vector2 = ProjectSettings.get_setting("physics/2d/default_gravity_vector")
var gravity_magnitude : int = ProjectSettings.get_setting("physics/2d/default_gravity")