This is rather a question for mathoverflow. The canonical map $\pi^* : \mathrm{Pic}(X)\to\mathrm{Pic}(X\times\mathbb A^1)$ is an isomorphism when $X$ is normal, and there are counterexamples with $X$ local integral of dimension $1$ and of course non-normal (with no isomorphism between $\mathrm{Pic}(X)$ and $\mathrm{Pic}(X\times\mathbb A^1)$).
First suppose $X$ is normal. As $\pi^*$ is injective, it is enough to consider affine open subsets of $X$. Then descend to finitely generated $\mathbb Z$-algebras. Taking integral closure and because $\mathbb Z$ is excellent, we are reduced to the case $X$ noetherian and normal. Now apply EGA IV.21.4.11, page 360. Note that the same arguments apply for any non-empty open subset of $\mathbb A^1_\mathbb Z$, e.g., $\mathbb G_m$, instead of $\mathbb A^1$.
Now let us see a counterexample with $X$ non-normal. I will take the first integral non-normal example which comes to my mind: $X=\mathrm{Spec}(R)$ where $R$ is the local ring $$R=(k[u,v]/(u^2+v^3))_{(u,v)}$$
over a field $k$ of characteristic zero. Let $K=\mathrm{Frac}(R)$. As $X$ is local, $\mathrm{Pic}(X)$ is trivial. Denote by $Y:=X\times \mathbb A^1$. We want to show $\mathrm{Pic}(Y)$ is non-trivial.
Consider the polynomial
$$f=1+vT^2\in R[T].$$
It is chosen in such a way that $f$ is not irreducible in $K[T]$ :
$$f=(1+tT)(1-tT)=(v+uT)(1/v+(v/u)T),\quad t:=-u/v\in K$$
but is $f$ irreducible (I don't say prime) in $R[T]$ (I don't use explicitly this property, just to explaine where comes this $f$). Note that $Y$ is covered by the two affine open subsets $D(f)$ and the generic fiber $Y_K$. Let $L$ be the invertible sheaf on $Y$ given by
$$L({D(f)})=(v+uT)R[T]_f, \quad L({Y_K})=K[T].$$
This is well defined because $(v+uT)$ is an invertible element of $O_Y(D(f)\cap Y_K)=K[T]_f$.
Admit for a moment that
$(R[T]_f)^{\star}=R^{\star}f^{\mathbb Z}$.
If $L$ is free, then there exist $\omega=af^{r}\in (R[T]_f)^\star$ and $\lambda\in (K[T])^\star=K^\star$ such that $(v+uT)\omega=\lambda$. This is impossible by comparing the degrees of both sides in $K[T]$. So $\mathrm{Pic}(Y)$ is non-trivial. The above fact on the units of $R[T]_f$ is (with the new $f$) easy to see. But I can post my solution if you want.
Let's understand the subsequent arguments of the proof in steps. I will use the notation in your link's answer (, in which $T_x = \mathrm{Spec}\mathcal{O}_x$, and $X^{(1)}$ is the set of 1-codimensional points of $X$).
- The principal divisor $(f_x)$ on $X$ has the same restriction to $\mathrm{Spec}\mathcal{O}_x$ as $D$, hence they differ only at prime divisors which do not pass through $x$.
Recall that $D_x=\sum_{y\in X^{(1)}\cap T_x}n_y\cdot(\overline{\{y\}} \cap T_x)$, and that as a principal divisor in the $X$, $(f_x)=\sum_{y\in X^{(1)}}v_y(f_x)\cdot \overline{\{y\}}$, where $v_y$ is the valuation on the prime divisor $\overline{\{y\}}$.
Then note that the valuation of $\overline{\{y\}}$ is just the valuation of $\overline{\{y\}}\cap T_x$, since they have the same local rings on $y$. Thus the restrictions of $D_x$ and $(f_x)$ are both equal to $\sum_{y\in X^{(1)}\cap T_x}v_y(f_x)\cdot(\overline{\{y\}}\cap T_x)$, and globally they differ just at those points not in the $T_x$. But it's clear that a prime divisor doesn't pass through $x$, if and only if its generic point is not in the $T_x$.
- There are only finitely many of these which have a non-zero coefficient in $D$ or $(f_x)$, so there is an open neighbourhood $U_x$ of $x$ such that $D$ and $(f_x)$ have the same restriction to $U_x$.
That's really clear because $T_x$ is just the intersection of all open neighbourhoods of $x$, and replacing $T_x$ by a neighbourhood $U_x$ won't change the coefficients in both divisors.
- Covering $X$ with such open sets $U_x$, the functions $f_x$ give a Cartier divisor on $X$. Note that if $f$,$f'$ give the same Weil divisor on an open set $U$, then $f/f'\in\Gamma(U,\mathcal{O}^*)$, since $X$ is normal.
The second sentence needs to be verified. $(f)=(f')$ implies that $(f/f')=0$, whence in each $y\in X^{(1)}$, $f/f'$ is a unit of $\mathcal{O}_y$. For every affine open subset of $X$, say $\mathrm{Spec}A$, I claim that $f/f'$ is a global section on it, i.e. $f/f'\in A$. Indeed, each prime ideal $\mathfrak{p}$ of $A$, of height $1$, corresponds to a point of codimension $1$ in $X$, and thus $f/f'\in A_\mathfrak{p}$. Since $A$ is a normal noetherian domain, by commutative-algebra theories, we have
$$A=\bigcap_{\mathrm{ht}\mathfrak{p}=1}A_\mathfrak{p}.$$
Therefore $f/f'\in A$. Then given an affine open covering $\{U_i\}$ of $U$, $(f/f')|_{U_i}\in\Gamma(U_i,\mathcal{O})$, so one can glue them into a section in $\Gamma(U,\mathcal{O})$. Actually this section is just $f/f'$ because they must be the same in $\mathscr{K}$. Thus $f/f'\in\Gamma(U,\mathcal{O})$. Similarly, $f'/f$ is also in the $\Gamma(U,\mathcal{O})$. So we have $f/f'\in\Gamma(U,\mathcal{O}^*)$.
Best Answer
Indeed, it suffices to prove that there is already an injection between the groups of divisors themselves $\operatorname {CaDiv}(X)\to \operatorname {WDiv}(X)$ (before passing to the classes) and for that we can reduce to the case when $X=\operatorname {Spec}A$, where $A$ is an integrally closed domain.
The result then follows from the equality for an integrally closed domain $A$:$$A=\bigcap_{\operatorname {ht }\mathfrak(p)=1} A_\mathfrak p$$ Details in Görtz-Wedhorn,Theorem 11.38(1), page 307.
For example consider the curve $X\subset \mathbb P^2_\mathbb C\;$ given by the equation $y^2z=x^3$.
Its Picard group is isomorphic to $\mathbb Z\oplus \mathbb C$ (Hartshorne, Exercise 6.9 (b), page 148)
Its Weil class group however is just $\mathbb Z\cdot[P]$, where $[P]$ is the class of any smooth point $P$ of $X$.