Look closely at the heatshrink tubing on the LED leads: you can see a resistor-shaped bulge. Try removing the heatshrink on one and repeating your diode measurement without the resistor in circuit. Your meter in diode mode can't source enough current to drive the LED with the resistor in series. In other words, the meter won't be providing the higher voltage that was expected when the resistor was added. (This sort of pre-wired LED is commonly sold for hobbyists who just want to use them, as you said, in 5 or 12 volt situations.)
The other questions linked in my comment to your question are about calculating resistor values for LEDs to achieve a specific current. You should be familiar with those to know the basics of how LEDs aren't linear, and how the LED's forward voltage helps determine the value of resistor to use for a given desired current and a given supply voltage.
Working from your explanation, you said that you successfully lit the LED using both 5 and 12 volts. This is not surprising, but the current through the LED will be of course higher with 12 volts applied. The question then is, did the manufacturer intend the LED to be compatible with either? It could be that the current limiting resistor was chosen so that the LED works just fine at 12 V and is still suitably bright at 5 V.
You didn't mention what color the LED is but let's assume it has a forward voltage of 3 V. Let's further assume that the LED can tolerate 20 mA.
How much voltage will the resistor be "dropping" with 12 V applied? \$12 - 3 = 9 V\$
How much resistance is needed to limit current to 20 mA? \$9 / 0.02 = 450 Ω\$
How much current will the LED still see with 5 V applied? \$2 / 450 = 4.4mA\$
Most modern, efficient 5mm LEDs like the one pictured will be nice and bright even at ~4 mA.
So I'm curious, what resistor value is hiding under the heatshrink? If it's meant to provide 20 mA at 5 V, then applying 12 V will probably burn the LED up if left too long. Perhaps it's a higher resistance meant to allow it to work to voltages even higher than 12. You should do some more experimenting to find out.
(Another thing you can do if you don't want to disassemble anything, since you have a multimeter, is measure current through the pre-wired assembly and vary the supply voltage. If you assume the LED can only tolerate 20 mA at 100 % duty cycle, then whatever voltage you reach which results in 20 mA can be treated as the maximum.)