Yes - in principle. But you need more than a single image to do this:
1. If you have 2 images taken from slightly differing angles you can implement triangulation. (Additionally this requires information about the camera.)
2. If you've gotten an object with well-known dimensions in the scene (and know the scaling of the image), you can calculate the depth (distance) via the projection object -> image.
If you only need to estimate approximate distance to a single subject, there are some techniques using a projection model to do that from a single image. As mentioned by U. Dreher, you need some additional information, such as the camera intrinsic parameters (focal distance), and the real-world size of the subject. I believe you can also work out the distance in case the subject is standing on a ground-plane and you can detect the point where the subject touches that plane, and you know the height of the camera from the ground plane. I believe there are some smartphone apps using such techniques, estimating a single approximate distance from a single image.