If it is a flat object, yes - with a bit of calibration. You need to know the distance, angle, sensor size, and focal length.
If it is an irregular object, photogrammetry can be used to create a 3D model from many images of the object taken at different view points. Software (free photogrammetry programs exist) is used to create a 3D model which can be imported in to a solid model manipulation program.
Edit with regards to the OP's comment:
The high school physics answer is to use the thin lens equation for field of view (FOV):
$$ FOV = {2 \times arctan \left({sensor\_size \over {2 \times f}} \right)} $$
Where:
\$sensor\_size\$ = some dimension of the sensor in mm. I like using the horizontal dimension.
\$f\$ = actual focal length of the lens in mm. Do not use the equivalent 35 mm focal length. This information can be found in the EXIF header of your image.
$$ pixel\_angle = {horizontal\_FOV \over number\_of\_horizontal\_pixels } $$
Determine the pixel dimensions of the object and multiply by the \$ pixel\_angle \$ to get the angular dimensions of your object.
A little bit of trigonometry assuming the object is centered:
$$ size\_in\_mm = {2 \times distance\_in\_mm \times tan \left (angular\_dimension \over {2} \right)} $$
You'll probably find that this method gives quite a bit of error due to the focal length not being reported accurately; and; if focused closely the magnification factor will throw the apparent focal length off.
A better technique is to take a picture of a rectangle of known dimensions. From this, you can scale your unknown object to the reference image of the known rectangle.
You can also place a scale (ruler) in the image of your object and figure out what the dimensions are of your object from the reference scale (ruler). This is the technique I use since distance and focal length are not needed.
Notes on dimensioning from images:
Use as large of a distance as possible to reduce perspective distortion and wide angle lens distortion. I generally shoot from a distance of about 10 x object_size if I need to meld images of an object in to a 2D drawing or figure out dimensions of an odd object that can't be readily measured with calipers.
The object needs to be parallel to the sensor plane. If not parallel, you'll get keystoning which takes extra steps to correct.
Use a lens with a minimal amount of distortion. I usually use a macro lens since macros generally have a flat field of view and very little distortion.