Is it always necessary to use two cameras to find the distance between camera and object?
There are various ways to measure distance and 3D using a single camera.
These include:


Moving the camera and taking another image - this simulates a 2 camera system.
If you are imaging an object of a known size, then you can know the distance with some simple trigonometry.
You can project a known pattern from a known projector location to reconstruct 3D. This is structured light and e.g. how Kinect works. Obviously the image(s) with the pattern will appear different from the normal image, so multiple exposures might be neccesary if you also want the appearance image.
You can use Depth-from-Defocus by capturing multiple images at multiple focii.
Sometimes an auto-focus lens can provide rough estimates on the depth of the object in focus. If the object is big enough in the frame this may be sufficient for some applications.


Each method has different trade-offs. You must consider which one suits your app.