It can be measured by measuring the proportion of soil toxicity of some elements in the soil in the laboratory, such as lead, aluminum and some chemical compounds formed in the soil as a result of interactions.
ultimately bioassay with sensitive organisms is used. Correlations to heavy metal, or toxic organics (xeno-chemicals) can be confounded by speciation that limits solubility and availability to be bioconcentrated or uptake by target organism. Clays, and humic materials are often the moderators to availability.
It is complicate. I do not simple way to it. There are some indicator to some heavy metals un solo, but it not true. May be with biológical indicador as nemátodes
As Jose A. Martin mentioned above, you need to be more specific: toxicity to what? Al, Mn (as in soil acidity) or As, Cd, Pb (as in metal contaminated soils).