A version of this is well known:
Let $X\subset \Bbb R^3$ be a compact set and suppose every intersection of $X$ by a plane is contractible. Then $X$ is convex.
This is due to Schreier (1933) in $\Bbb R^3$, and Aumann (1936) generalized this to higher dimensions. See this and other related results in Ju.D. Burago and V.A. Zalgaller, Sufficient criteria of convexity, J. Math. Sci. 10 (1978). 395–435. Incidentally, this a (hard) exercise in my book (Exc. 1.25).