Let $W_t= -B_t$. Moreover, let $a= - \frac{r-\frac{1}{2}\sigma^2}{\sigma}$ and $b= -\frac{1}{\sigma}\ln \frac{S^*}{S_0}$. Then, as in this question,
\begin{align*}
\mathbb{P}\left(\tau \ge T \mid W_T\right)\pmb{1}_{\{W_T \le b-aT\}} &= \mathbb{P}\left(W_t+at \le b, t\in[0, T] \mid W_T\right)\pmb{1}_{\{W_T \le b-aT\}}\\
&=\Big[1-\exp\Big(-\frac{2}{T}b\big(b-W_T-aT\big)\Big)\Big] \pmb{1}_{\{W_T \le b-aT\}},
\end{align*}
and, consequently,
\begin{align*}
\mathbb{P}(\tau \ge t) &= \Phi\left(\frac{b-at}{\sqrt{t}}\right) - e^{2ab}\Phi\left(\frac{-b-at}{\sqrt{t}}\right),
\end{align*}
where $\Phi$ is the cumulative distribution function of a standard normal random variable.
The density function is then given by
\begin{align*}
\frac{b}{\sqrt{2\pi t^3}}e^{ab}e^{-\frac{1}{2}\left(\frac{b^2}{t}+a^2t \right)}\pmb{1}_{t> 0} = \frac{b}{\sqrt{2\pi t^3}} e^{-\frac{1}{2}\left(\frac{b-at}{\sqrt{t}}\right)^2}\pmb{1}_{t> 0}
\end{align*}
Therefore,
\begin{align*}
E\left(\pmb{1}_{\tau \leq \infty }e^{-r\tau}\right) &= \int_0^{\infty} e^{-rt}\frac{b}{\sqrt{2\pi t^3}} e^{-\frac{1}{2}\left(\frac{b-at}{\sqrt{t}}\right)^2}dt \\
&=e^{ab - b \sqrt{2r+a^2}}\int_0^{\infty} \frac{b}{\sqrt{2\pi t^3}} e^{-\frac{1}{2}\left(\frac{b-\sqrt{2r+a^2}t}{\sqrt{t}}\right)^2}dt \\
&=e^{ab - b \sqrt{2r+a^2}}\left[\Phi\left(\frac{b-\sqrt{2r+a^2}t}{\sqrt{t}}\right) - e^{2b\sqrt{2r+a^2}}\Phi\left(\frac{-b-\sqrt{2r+a^2}t}{\sqrt{t}}\right) \right]_{\infty}^0\\
&=e^{ab - b \sqrt{2r+a^2}}\\
&=\left(\frac{S^*}{S_0}\right)^{\frac{2r}{\sigma^2}}.
\end{align*}
Alternative Solution
We define the probability measure $\tilde{P}$ such that
\begin{align*}
\frac{d\tilde{P}}{dP}\big|_t = e^{-\frac{1}{2}a^2 t - aW_t},
\end{align*}
where $P$ is the original probability measure. Then $\tilde{W}_t = W_t + at$ is a standard Brownian motion under $\tilde{P}$. Let $E$ and $\tilde{E}$ be expectations with respect to measures $P$ and $\tilde{P}$.
Then,
\begin{align*}
E\left(\pmb{1}_{\tau \leq \infty }e^{-r\tau}\right) &= \tilde{E}\left(\frac{dP}{d\tilde{P}}\big|_{\tau} \pmb{1}_{\tau \leq \infty }e^{-r\tau}\right)\\
&= \tilde{E}\left(\left(\frac{d\tilde{P}}{dP}\big|_{\tau}\right)^{-1} \pmb{1}_{\tau \leq \infty }e^{-r\tau}\right)\\
&= \tilde{E}\left(e^{\frac{1}{2}a^2 \tau + aW_{\tau}} \pmb{1}_{\tau \leq \infty }e^{-r\tau}\right)\\
&= \tilde{E}\left(e^{-\frac{1}{2}a^2 \tau + a\tilde{W}_{\tau}} \pmb{1}_{\tau \leq \infty }e^{-r\tau}\right)\\
&= \tilde{E}\left(e^{-\frac{1}{2}\left(2r+a^2\right) \tau + \sqrt{2r+a^2} \tilde{W}_{\tau} +(a-\sqrt{2r+a^2}) \tilde{W}_{\tau} } \pmb{1}_{\tau \leq \infty }\right)\\
&= \tilde{E}\left(e^{-\frac{1}{2}\left(2r+a^2\right) \tau + \sqrt{2r+a^2} \tilde{W}_{\tau} +(a-\sqrt{2r+a^2}) b } \right)\\
&= e^{(a-\sqrt{2r+a^2}) b},
\end{align*}
by the optional sampling theorem.