The problem is in the fact that babel-czech makes the hyphen a shorthand character, but soul has no check for an active -; the result is that as many characters at the end are mangled as there are hyphens in the text.
Here is a workaround using regexpatch:
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{soulutf8}
\usepackage{regexpatch}
\makeatletter
\regexpatchcmd*{\SOUL@eval}
{\cO-}
{\cA-}
{}{}
\makeatother
\begin{document}
\ul{$n$-rozměrný}
\ul{$n$ rozměrný}
\ul{a-b-cd}
\end{document}

Note that the IL2 encoding is obsolete and not recommended any more. I'd prefer utf8 to utf8x, as it's more stable.
Without regexpatch it's possible too, but quite indirectly.
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{soulutf8}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\SOUL@eval}{-}{\SOUL@@@hyphen}{}{}
\patchcmd{\SOUL@eval}{-}{\SOUL@@@hyphen}{}{}
\catcode`-=\active
\patchcmd{\SOUL@eval}{\SOUL@@@hyphen}{-}{}{}
\patchcmd{\SOUL@eval}{\SOUL@@@hyphen}{-}{}{}
\catcode`-=12
\makeatother
\begin{document}
\ul{$n$-rozměrný}
\ul{$n$ rozměrný}
\ul{a-b-cd}
\end{document}
IL2, norutf8xnor thedvipsglobal option. – egreg Jul 24 '14 at 09:57IL2andutf8xwould make Czech characters disappear. – John Manak Jul 24 '14 at 10:02\usepackage[T1]{fontenc}and\usepackage[utf8]{inputenc}. – egreg Jul 24 '14 at 10:30\mboxor use\shorthandoff{-}. – Ulrike Fischer Jul 24 '14 at 10:38