Let $X = [0,1]^d$ be the unit cube in the $d$dimensional Euclidean space. For every $x \in X$ and every coordinate $i=1,2,\ldots,d$ denote by $x_{i} := (x_j)_{j \neq i}$. Given a set $Y \subseteq X$ and a vector $x_{i} \in [0,1]^{d1}$ denote by $Y_{x_{i}} := \{(x_i,x_{i}) \in Y \colon x_i \in [0,1]\}$ the $x_{i}$section of $Y$. Let $Y \subseteq X$ be a compact set that satisfies the following condition: for every $x \in X$ and every coordinate $i=1,2,\ldots,d$, the $x_{i}$section $Y_{x_{i}}$ is nonempty and convex. Is it true that the set $Y$ is contractible?
TL;DR: Yes, it is contractible, and it is enough for that condition to hold for a single $i \in \{1,...,d\}$. To see this, we will construct a strong deformation retraction of $[0,1]^{d}$ to $Y$.
Firstly, a little of notation. Fix one $i \in \{1,...,d\}$, without loss of generality $i=d$. Write $\pi:[0,1]^d \rightarrow [0,1]^{d1}$ for the map $x \mapsto x_{d}$, write $\sigma:[0,1]^d \rightarrow [0,1]$, for the map $x \mapsto x_{d}$, and for every $x \in [0,1]^{d1}$ write \begin{equation} Y_{x} := Y \cap \pi^{1}(\{x\}) = \{y \in Y \vert \pi(y)=x\} \end{equation}
Over every $x \in [0,1]^{d1}$, your assumption that $Y_{x}$ be nonempty and convex forces it to be an interval $Y_{x} = I_x\times \{x\}$; because $Y$ is compact, furthermore, it must be closed, and hence all intervals $I_x$ are also closed. Let $m_x,M_x$ be the minimum/maximum of $I_x$ respectively, so that $I_x = [m_x,M_x]$.
We could try to define a strong deformation retraction $f:[0,1]^d \times [0,1] \rightarrow [0,1]^d$ of $[0,1]^d$ to $Y$ as follows: \begin{equation} f(z,t) := \begin{cases} \big(\pi(z),(1t)\sigma(z)+t M_{\pi(z)}\big) &\text{ if } \sigma(z) \in [M_{\pi(z)},1]\\ z &\text{ if } \sigma(z) \in [m_{\pi(z)},M_{\pi(z)}]\\ \big(\pi(z),(1t)\sigma(z)+t m_{\pi(z)}\big) &\text{ if } \sigma(z) \in [0,m_{\pi(z)}]\\ \end{cases} \end{equation} It is easy to check that $f(z,0) = z$ for all $z \in [0,1]^d$, that $f(z,1) \in Y$ and that $f(z,t) = z$ for all $z \in Y$. Unfortunately, $f$ is not continuous: there is in general no guarantee that $m_{x_n} \rightarrow m_x$ and $M_{x_n} \rightarrow M_x$ whenever $x_n \rightarrow x$. Instead, we work with a ``regularised'' version of minima and maxima.
Let $(\psi^{(t)})_{t \in [0,1]}$ be a continuous family of continuous probability density functions on $[0,1]$, supported on $[0,1t]$ and converging to the Diract delta distribution at $0$ as $t \rightarrow 1$. For $x \in [0,1]^{d1}$, define a function $ms_x:[0,1] \rightarrow [0,1]$ by letting $ms_x(r)$ be the minimum of $m_y$ over all $y$ in the closed ball of radius $r$ around $x$; similarly, define $Ms_x:[0,1] \rightarrow [0,1]$ by letting $Ms_x(r)$ be the maximum of $M_y$ over all $y$ in the closed ball of radius $r$ around $x$. We have $ms_x(0) = m_x$ and $Ms_x(0) = M_x$.
The functions $ms_x$ and $Ms_x$ are monotonically decreasing/increasing respectively, and hence we can use the probability density functions to define the following continuous functions $[0,1]^{d1}\times [0,1] \rightarrow [0,1]$: \begin{equation} \bar{m}(x,t) := \int_0^1 ms_x(r) \psi^{(t)}(r) dr \hspace{2cm} \bar{M}(x,t) := \int_0^1 Ms_x(r) \psi^{(t)}(r) dr \end{equation} In particular, $\bar{m}(x,1) = m_x$ and $\bar{M}(x,1) = M_x$. Then we can redefine the retraction $f:[0,1]^d \times [0,1] \rightarrow [0,1]^d$ as follows, this time as a continuous function: \begin{equation} f(z,t) := \begin{cases} \big(\pi(z),(1t)\sigma(z)+t \bar{M}(\pi(z),t)\big) &\text{ if } \sigma(z) \in [M_{\pi(z)},1]\\ z &\text{ if } \sigma(z) \in [m_{\pi(z)},M_{\pi(z)}]\\ \big(\pi(z),(1t)\sigma(z)+t \bar{m}(\pi(z),t)\big) &\text{ if } \sigma(z) \in [0,m_{\pi(z)}]\\ \end{cases} \end{equation} This is our desired strong deformation retraction from $[0,1]^d$ to $Y$.

$\begingroup$ This answer is likely related, but I couldn't determine whether all necessary conditions for the theorems mentioned therein are necessarily satisfied in this case. $\endgroup$ – Stefano Gogioso Sep 7 '18 at 1:02