The answer for a general finite set $S$, including the special case $S=\{1,\dots, n\}$, is provided here in three cases. Let $P_M$ denote the set of pairs $(a,b)\in S\times S$ with $a<b$ such that $a+b=2\,\text{Median}(S)$. Moreover, define the sets $S(<c)=\{x\in S: x<c\}$ and $S(>c)=\{x\in S: x>c\}$ for any $c \in S$.
Remark: In @Aig's answer, presented for $S=\{1,\dots, n\}$, the probability for case that $m$ is even and $n$ is odd is considered $0$, which is not always correct. Indeed, for $S=\{1,\dots, 2k+1\}$, whose median is $k+1$, and $m=2$, there are $k$ sets $\{1, 2k+1\},\{2, 2k\}, \dots ,\{k-1, k+2\}$ whose medians are all $k+1$, and the probability is not zero. The number of such sets for any even $m$, can be obtained using the formula given for Case 2, by considering that $|S(<c)|=c-1$, $|S(>c)|=n-c$, and $$P_M=\big\{(1, 2k+1),(2, 2k), \dots ,(k-1, k+3)\big\}.$$
Case 1: Both $m$ and $n$ are odd numbers
The probability is
$$\frac{\begin{pmatrix} \frac{n-1}{2} \\ \frac{m-1}{2} \end{pmatrix}
^2}{\begin{pmatrix} n \\ m \end{pmatrix}}$$
Case 2: $m$ is even ($n$ can be even or odd)
The probability is
$$\frac{\sum_{(a,b)\in P_M}\begin{pmatrix} |S(<a)| \\ \frac{m-2}{2} \end{pmatrix}\begin{pmatrix} |S(>b)| \\ \frac{m-2}{2} \end{pmatrix}}{\begin{pmatrix} n \\ m \end{pmatrix}}.$$
In this case, the median of the subset can be equal to the median of $S$ if there are pairs in $S$ whose average is equal to the median of $S$, that is, $P_M\neq \emptyset$.
Case 3: $m$ is odd and $n$ is even
The probability is $0$, as the average of the two middle numbers forming the median of $S$ is not in $S$.