I will restrict myself only to Lie groups, since the world of groups outside of this class is way too large and, I do not think, there is a good answer in this context. I will also restrict to simply-connected Lie groups so that the answer is reasonably neat. (This is not a very good reason, but this will keep my answer reasonably brief, I did not think through the details in the non-simply connected case which will have to require some hard case-by-case analysis: If you really want to find out the answer in this case, you would have to do it yourself or ask somebody else who has more time to spare.)
I will say that a Lie group $G$ is rigid if every Lie group homeomorphic to $G$ is in fact isomorphic to $G$.
Now, let's apply some structural results for Lie groups in this context. Every simply-connected Lie group will have the Levi-Malcev decomposition
$$
G= S \rtimes H,
$$
where $S$ is solvable and simply connected and $H$ is connected and has semisimple Lie algebra. Then $S$ is homeomorpbic to some ${\mathbb R}^n$ and, hence, if $n\ge 2$ then $S$ has non-unique Lie group structure (one can use either commutative or solvable noncommutative one). Since we can always use trivial action of $H$ on $S$ without changing topology of semidirect product, it follows that $G$ cannot be rigid if $n\ge 2$. If $n=1$ then $H$ has to act trivially on $S$ (as $H$ is connected, semisimple and, hence, has only trivial characters) and, thus, $G\cong {\mathbb R}\times H$. Therefore, in both cases $n=0, n=1$ the problem reduces to rigidity of the groups $H$.
Case 1. $H$ is compact. I then found by browsing this mathoverflow post that $H$ has to be rigid. By compactness of $H$ it is also clear that $G$ is rigid as well in this case.
Case 2. $H$ is noncompact. If $H$ happens to have finite center then it has the
Iwasawa decomposition $H= U\cdot K$, where $K$ is maximal compact subgroup in $H$ and $U$ is solvable and homeomorphic to $R^m$ for some $m\ge 2$; in particular, $H$ is homeomorphic to ${\mathbb R}^m\times K$. (Algebraically, this is never a product!) Clearly, we can also endow ${\mathbb R}^m\times K$ with the algebraic structure of the direct product, hence, $H$ cannot be rigid; thus, $G$ is not rigid either. This leaves us with the case of infinite discrete center. (The standard example to think about is the universal cover of $SL(2, {\mathbb R})$.) However, every such $H$ can be divided by a discrete central subgroup $Z<H$, such that $Q=H/Z$ has trivial center. Then we can apply the same reasoning as above to conclude that $Q$ is non-rigid and then lift the modified Lie group structure to the covering space $H$ (of $Q$) to conclude that $H$ is again non-rigid.
Thus, the conclusion is that a simply-connected Lie group $G$ is rigid if and only if it is either compact or a product of a compact group and ${\mathbb R}$.