This problem was studied by Fujita in his paper "Cancellation problem for projective varieties", Inventiones Mathematicae 64 (1981). 

He showed that the obstruction to cancellation lies in the Picard group; more precisely, he proved the following remarkable result, see Corollary 7 in the cited paper.

Let $M$, $V$ and $W$ be compact complex manifolds such that $M \times V \cong M \times W$. Assume that $M$ is projective and that $\textrm{Alb}(M)=0$ or $\textrm{Alb}(V)=0$. Then $V \cong W$.

In particular, cancellation problem has a positive answer for $M=\mathbb{P}^n$.