If $M$ is of dimension $<4$, then the answer is YES as there is no exotic structures on $M$ and classification results are well studied.

It is *not true* in dim 4. For example, 

Any closed simply-connected 4-manifold $M$ and its 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). Which is trivial by high dimensional s-cobordism theorem which says that such a cobordism is trivial if Whitehead torsion of $\pi_1(M\times S^1)$ vanish (https://en.wikipedia.org/wiki/H-cobordism#The_s-cobordism_theorem) and $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 dim of $M$ is $>4$ then the answer is YES if $M$ is simplyconnected.

 To see this notice that it is enough to show that $M$ and $M'$ are h-cobordant. We know that $M\times S^1$ is diffeomorphic to $M'\times S^1$. So there is a map $f:M \to M'\times S^1$. As $M$ is simplyconnected $f$ has a lift $\bar{f}$ to the universal cover $M'\times \mathbb R$. Image of $\bar{f}$ separating $M'\times \mathbb R$, If it is not then one can cut $M'\times \mathbb R$ along $img(\bar{f})$ and connect the two boundary component by an arc $\gamma$. This arc in the original manifold $M'\times \mathbb R$ gives rise to a closed curve $\gamma'$ which transversally intersect $img(\bar{f})$ at a single point. But $M'\times \mathbb R$ is simply connected and thus $\gamma'$ is homotopic to a point which is contradicting the transverse intersection points. Now given the fact that $M$ is compact, we can find a cobordism from $img(\bar{f})=M$ to $M'\times \{t\}$ for some sufficiently large $t\in \mathbb R$. Notice that as everything is simplyconnected and projection map induces isomorphisms on homologies, so by Hurewitz's theorem we can conclude that this is an h-cobordism and thus $M$ and $M'$ are diffeomorphic.