As written in my comment, you can tell LaTeX
to behave differently if you are inside or outside the math mode using the TeX
command \if<>\else<>\fi
; specifically using the conditional form:
\ifmmode<expression inside math>
\else
<expression outside math>
\fi
So if this code is applied to your MWE:
\documentclass{article}
%
\usepackage{siunitx}
\sisetup{range-phrase=%
\ifmmode\mathbin{-}
\else
\thinspace\textendash\thinspace
\fi%
}
%
\begin{document}
%
\centering
\SIrange{e-12}{e-10}{\second}
\[
\SIrange{e-12}{e-10}{\second}
\]
%
\end{document}
The result is:

Update
There is another way of having the correct dash, as egreg suggested, by considering the inclusion of text inside the math mode, replacing \mathbin{-}
with:
\sisetup{range-phrase=%
\ifmmode\text{\,\textendash\,}
\else
\thinspace\textendash\thinspace
\fi%
}
%
Obtaining:

-
is interpreted differently in relation to the environment, so to obtain the same you could substitute the-
to\textendash
, or leave a conditional (more complicated)\sisetup{range-phrase= ~\endash~}
to be consistent with the typography rules.sisetup{range-phrase= ~\texendash~}
. Feel free to accept the answer if it has solved your issues.(from) <first val> to <second val>
in (running) text (or similar construction) and<first val> \cdots <second val>
in math-mode so that the endash (or even your actual minus sign) doesn't get confused with a subtraction. Typographically, an en-dash without space around it is correct.