If $M$ and $N$ are closed and $M\times S^1$ is diffeomorphic to $N\times S^1$, is it true that $M$ and $N$ are diffeomorphic?

If $M$ is of dimension $<4$ then the answer is YES because there are no exotic structures on $M$ and there are full classification results.

It is not true in dimension 4. For example, any closed simply-connected 4-manifold $M$ and an exotic copy $M'$ are h-cobordant by a theorem of Wall. Thus $M\times S^1$ is h-cobordant to $M'\times S^1$ (as one can extend the previus h-cobordsim trivially on the $S^1$ component). This is then a trivial cobordism by the high-dimensional s-cobordism theorem which says that such an h-cobordism is trivial if the Whitehead torsion of $\pi_1(M\times S^1)$ vanishes and indeed $Wh(\pi_1(M\times S^1))= Wh(\mathbb Z)=0$ by a result of Bass (http://www.numdam.org/item/?id=PMIHES_1964__22__61_0). So they are in fact diffeomorphic.

When the dimension is $>4$ the answer is YES if $M$ is simply-connected. To see this, notice that it is enough to show that $M$ and $M'$ are h-cobordant. Since $M\times S^1$ is diffeomorphic to $M'\times S^1$ there is a map $f:M \to M'\times S^1$. Since $M$ is simply-connected $f$ has a lift $\bar{f}$ to the universal cover $M'\times \mathbb R$. We claim that the image of $\bar{f}$ separates $M'\times \mathbb R$. Otherwise we can cut $M'\times \mathbb R$ along $Im(\bar{f})$ and connect the two boundary components by an arc $\gamma$. This arc in the original manifold $M'\times \mathbb R$ gives rise to a closed curve $\gamma'$ which transversally intersects $Im(\bar{f})$ at a single point. But $M'\times \mathbb R$ is simply-connected and thus $\gamma'$ is homotopic to a point disjoint from $Im(\bar{f})$, contradicting the homotopy-invariant count of transverse intersection points. Now, since $M$ is compact we can find a cobordism from $Im(\bar{f})\approx M$ to $M'\times \{t\}$ for some sufficiently large $t\in \mathbb R$. Since everything is simply-connected and the projection map induces isomorphisms on homologies, by Hurewitz' theorem we can conclude that this is an h-cobordism and so $M$ is diffeomorphic to $M'$.


The manifolds $M$ and $N$ may not even be homotopy equivalent!

In Compact Flat Riemannian Manifolds: I, Charlap showed that there are two closed flat manifolds $M$ and $N$ of the same dimension which are not homotopy equivalent (this is equivalent to $\pi_1(M) \not\cong \pi_1(N)$ as $M$ and $N$ are aspherical), such that $M\times S^1$ and $N\times S^1$ are diffeomorphic (which is equivalent to $\pi_1(M\times S^1) \cong \pi_1(N\times S^1)$ as closed flat manifolds are determined up to diffeomorphism by their fundamental group).

For a more explicit example, see this excellent answer by George Lowther.