\sloppy
is a latex macro that does
\def\sloppy{%
\tolerance 9999%
\emergencystretch 3em%
\hfuzz .5\p@
\vfuzz\hfuzz}
\fussy
sets the values back to the latex defaults
\def\fussy{%
\emergencystretch\z@
\tolerance 200%
\hfuzz .1\p@
\vfuzz\hfuzz}
\tolerance
sets the maximum "badness" that tex is allowed to use while setting the paragraph, that is it inserts breakpoints allowing white space to stretch and penalties to be taken, so long as the badness keeps below this threshold.
If it can not do that then you get overfull boxes. So different values produce different typeset result.
\emergencystretch
(added at TeX3) is used if TeX can not set the paragraph below the \tolerance
badness, but rather than make overfull boxes it tries an extra pass "pretending" that every line has an additional \emergencystretch
of stretchable glue, this allows the overall badness to be kept below 1000 and stops TeX "giving up" and putting all stretch into one line. So \emergencystretch
does not change the setting of "good" paragraphs, it only changes the setting of paragraphs that would have produced over-full boxes.
Note that you get warnings about the real badness calculation from TeX even though it retries with \emergencystretch
the extra stretch is used to control the typesetting but it is not considered as good for the purposes of logging.
\hfuzz
does not affect the typesetting in any way but just stops TeX complaining if the box is is only slightly over-full.
\hbadness
not used in \sloppy
but used in the final example below` is similar, it does not affect the typesetting but stops TeX warning about underfull boxes if the badness is below the given amount.
The main problem with \sloppy
is the setting of \tolerance
to 9999 which is almost infinitely bad. That does not distribute the white space evenly but encourages individual lines of the paragraph to stretch the white space to arbitrarily large amounts. This was an acknowledged deficiency in TeX and why in TeX3 the new parameter \emergencystretch
was added. Unfortunately when adding \emergencystretch
to \sloppy
when definining it for LaTeX2e, we didn't reduce the \tolerance
setting, but left it at 9999, which is probably good for compatibility with LaTeX2.09, but bad for everything else.
Note final settings show that often you get a better setting with just setting \emergencystretch
and not changing \tolerance
at all, the setting is the same in both cases, but \hbadness=10000
silences the warnings. Not everyone would want the final setting without being warned about it, but in automatic typesetting contexts where changing the input is not a possibility and you never want over-full boxes, this is a possibility.

\documentclass[12pt]{article}
\usepackage{showframe}
\begin{document}
\def\test#1{{#1
\texttt{\detokenize{#1}}
Long made-up words, sloppy:
abcdefghijklabcdefghijkl abcdefghijklabcdefghijkl abcdefghijklabcdefghijkl
\textit{abcdefghijklabcdefghijkl abcdefghijklabcdefghijkl abcdefghijklabcdefghijkl abcdefghijklabcdefghijkl}
Long made-up words, textit, sloppy:
\textit{abcdefghijklabcdefghijkl abcdefghijklabcdefghijkl abcdefghijklabcdefghijkl abcdefghijklabcdefghijkl}
Here is a line with long unbreakable math, sloppy. ${a+b+c+d a+b+c+d}$ ${a+b+c+d a+b+c+d }$
Extreme unbreakable math, sloppy. ${a+b+c+d+e a+b+c+d+e a+b+c+d+e a+b+c+d+e }$ break ${a+b+c+d+e a+b+c+d+e a+b+c+d+e a+b+c+d+e }$
\nobreak\bigskip\hrule\filbreak}}
\test{}
\test{\sloppy}
\test{\setlength\emergencystretch{\hsize}}
\test{\setlength\emergencystretch{\hsize}\hbadness=10000}
\end{document}