$X$ is a union of disjoint connected sets, $X_i$ (the equivalence classes). If $X$ is disconnected and $U \cup V$ is a separation of $X$ (with $U$, $V$ disjoint and open in $X$), then there are two possible cases:
Case 1: One of the equivalence classes, say $X_i$, is split between $U$ and $V$:
But then, $X_i \cap U$ and $X_i \cap V$ are disjoint and open in $X_i$, so they are a separation of $X_i$, contradicting the assumption that all $X_i$'s are connected.
Case 2: Every equivalence class is entirely contained in either $U$ or $V$:
But then, $p(U)$ and $p(V)$ are disjoint. Since they are also open in $Y$, they are a separation of $Y$, contradicting the assumption that $Y$ is connected.
In sum, if $X$ is disconnected then either one of the equivalence classes is disconnected or the quotient space is disconnected.