Run-in titles are the default if you use \newmdtheorem
instead:

\documentclass{article}
\usepackage{mdframed}
\mdtheorem[font=\slshape, linewidth=1pt]{exercise}{Exercise}[section]
\newmdtheoremenv[linewidth=1pt]{exercisetwo}{Exercise}[section]
\begin{document}
\begin{exercise}
Sketch a decider machine for the halting problem.
\end{exercise}
\begin{exercisetwo}
Sketch a decider machine for the halting problem.
\end{exercisetwo}
\end{document}
However, as you can see the default also use the italic font rather than the slanted. Adding font=\slshape
will also change the shape of the heading Exercise
which you probably do not want. Loading the amsthm
package, before mdframed
, gives the chance to define new styles, see the documentation. For example, a slanted font, with no vectical space before the title and no punctuation after the title is given by defining a myexercise
style and used in exercisethree
:

\documentclass{article}
\usepackage{amsthm}
\usepackage{mdframed}
\mdtheorem[font=\slshape, linewidth=1pt]{exercise}{Exercise}[section]
\newmdtheoremenv[linewidth=1pt]{exercisetwo}{Exercise}[section]
\newtheoremstyle{myexercise}{-\topsep}{}{\slshape}{}{\bfseries}{}{.5em}{}
\theoremstyle{myexercise}
\newmdtheoremenv[linewidth=1pt]{exercisethree}{Exercise}[section]
\begin{document}
\begin{exercise}
Sketch a decider machine for the halting problem.
\end{exercise}
\begin{exercisetwo}
Sketch a decider machine for the halting problem.
\end{exercisetwo}
\begin{exercisethree}
Sketch a decider machine for the halting problem.
\end{exercisethree}
\end{document}