DEXA stands for dual-energy X-ray absorptiometry. Apparently it is often abbreviated as "DXA" these days, for reasons I'm not sure about. The technique consists of taking an X-ray image of the body at two different energy levels of radiation.
When taking an X-ray image of someone's body, some portion of the rays is going to be absorbed by the body, while the remainder gets through and is captured on a photosensitive film or a detector. The absorption rate is different for various tissues. Bones contain much calcium, which has a high absorption rate. Taking an X-ray image to examine bones is basically taking a picture of the bones' "shadow". The higher the bone density, the less of the radiation reaches the recipient (film/detector). How that is visualized depends on the used film or detector.
However, bone mass isn't the only tissue absorbing some of the radiation. This means that trying to establish exact bone density based on a single exposure will have limited accuracy because of factors such as lean body mass, fat mass, water retention and more. Now, above I mentioned that different tissues will have different absorption rates. This also depends on the energy of the radiation. Taking an image at a different energy level will result in less or more of that energy being absorbed by body mass other than bone mass. This allows us to refine the result. It is basically an example of more data points increasing accuracy.
Think of it like this. Suppose I have two sheets of different colored glass, each of which will filter certain light frequencies. I know how much of each frequency is going to be filtered out per centimeter of glass thickness for each color. If I put these two panes together and shine a beam of white light through it, the light that gets through, and its color, can tell me something about the two sheets of glass combined. But I might not be able to figure out the exact thickness of both. Maybe it could be 2 cm of sheet A and 1 cm of sheet B, but maybe 1.5 cm of both A and B would give the same result. But, if I shine two beams of light through the composite, with each beam having different frequencies (say, one beam blue light and one beam red light), then knowing how much of each frequency is filtered out by each sheet of glass and putting it all together lets me figure out the exact thickness for A and B. In our first situation, we have two variables but one equation. That situation could have infinite solutions. In the second situation, we have two variables and two equations, which will typically have one exact solution.
While a DXA scan is typically a technique for measuring bone density, it can also yield information about lean body mass and fat mass by combining the measurements of the two exposures. For fat measurement it's possible that different energies are used rather than those for bone density, but I don't know that for sure.
That's simplifying things a bit, though. A DXA scan won't be 100% accurate. First of all, because there are many tissues in the body with different absorption rates, and second because you're still only taking the two images in one plane (front to back of body, or the reverse). A thicker bone with lower density could still yield the same result as a thinner bone with higher density. The results would have to be combined with something like a CT-scan or MRI, or multiple DXA's from different angles, to get the complete picture. After all, we're 3-dimensional creatures, we don't live in Flatland. For its purposes, however, a DXA could well be accurate enough.
Finally, and this paragraph is purely opinion on my part, I'm not sure a DXA scan is worth it. Like any other measurement technique for body composition, it has its limitations. On top of that, you'd receive a dose of radiation. Perhaps not a dramatic one, but the stance on radiation is commonly that exposure should be kept as low as possible over an entire lifetime. For anything other than critical medical examination, I'd go with a different method. Hydrostatic weighing, while not cheap either and being a hassle, can also provide good results. Body fat calipers can be very inaccurate, both the calipers themselves (if they're cheap plastic things) and their use (method, location) but if you're consistent in where you're measuring, they provide excellent feedback regarding relative fat loss. That is, you can find out how subcutaneous fat is being reduced from week to week and month to month if you always use the same calipers in the same spot. I don't think most people really have any need for a body fat measurement at the accuracy of hydrostatic weighing or a DXA.