You can use the refcount package to get the page number of the reference. Then you can use the xifthen package to do a comparison of integer values. You can get the value of the current page with the \value{page} command. In the MWE below, you can comment or uncomment the \clearpage to demonstrate the difference in behavior.
\documentclass{article}
\usepackage{refcount}
\usepackage{xifthen}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}
\caption{Testing}\label{fig:test}
\includegraphics[width=0.4\textwidth]{temp}
\end{figure}
%Uncomment the clearpage command to get the pageref to print
%\clearpage
\ifthenelse{\getpagerefnumber{fig:test}=\value{page}}{}{\pageref{fig:test}}
\end{document}
You could now simplify things by changing the pageref command, so that you could can use pageref like normal, but it would run your conditional code.
\documentclass{article}
\usepackage{refcount}
\usepackage{xifthen}
\usepackage[demo]{graphicx}
\let\originalPageref\pageref
\renewcommand{\pageref}[1]{\ifthenelse{\getpagerefnumber{#1}=\value{page}}{}{\originalPageref{#1}}}
\begin{document}
\begin{figure}
\caption{Testing}\label{fig:test}
\includegraphics[width=0.4\textwidth]{temp}
\end{figure}
%Uncomment the clearpage command to get the pageref to print
%\clearpage
\pageref{fig:test}
\end{document}
varioref(andcleveref)?variorefadds\pagerefinto the reference, if the figure or table is more than one page away. – Kurt Aug 30 '12 at 16:18