There are $P\in U(n),Q\in U(p)$ s.t. $A=P^*\Delta P,Q^*BQ=D$ where $\Delta,D$ are diagonal real; then
$Q^*X^*P^*\Delta PXQ=D$, that is
$(1)$ $U^*\Delta U=D$, where $PXQ=U=[u_{i,j}]\in M_{n,p}$ or $X=P^{-1}UQ^{-1}$.
Equation $(1)$ is a system of $p(p+1)$ equations in the $2np$ real unknowns $Re(u_{i,j}),Im(u_{i,j})$.
We assume that $rank(B)=p$. If $rank(A)<p$, then, clearly, there are no solutions; assume that $n\geq rank(A)\geq p$
$\textbf{Proposition 1}$. Let $signature(\Delta)=(k+,l-),signature(D)=(r+,(p-r)-)$. If $k\geq r,l\geq p-r$, then there are many solutions in $U$ that depend at least on $p^2$ real parameters. When $rank(A)=p$, the solutions depend at least on $2np-p^2$ parameters;
$\textbf{Proof}$. We may assume that $\Delta=diag(\epsilon_{n-p},\delta_p)$, where $signature(\delta)=signature(D)$ and $U=\begin{pmatrix}V\\W_p\end{pmatrix}$; we impose $V=0$. Then $(1)$ can be written
$(2)$ $W^*\delta W=D$ where all the matrices are $p\times p$ and invertible.
$(2)$ is a system of $2p(p-1)/2+p=p^2$ equations in $2p^2$ real unknowns and moreover, $(2)$ admits real solutions $W$ (if $\Delta$ and $D$ have distinct eigenvalues, then $W$ is associated to a permutation of the elements of the basis, then to homotheties). We deduce the first result.
Now, if $rank(A)=p$, then $\epsilon=0$ and $V$ is arbitrary. We obtain at least $2p(n-p)+p^2=2np-p^2$ parameters.
EDIT. I forgot to say and to prove that the condition "$k\geq r,l\geq p-r$", in Proposition 1, is necessary.
$\textbf{Proposition 2.}$ Let $A,B\in M_n$ be Hermitian and $U\in M_{p,n}$ s.t. $U^*AU=B$. If $signature(A)=(k+,l-)$ and $signature(B)=(r+,s-)$ (we don't write the zeroes), then $k\geq r,l\geq s$.
$\textbf{Proof}$. Let $Z=[0,U]\in M_n$. Then $Z^*AZ=diag(0_{n-p},B)$. There is a sequence $(Z_m)_m$, in $GL_n$, that converges to $Z$. For every $m$,
$spectrum(Z_m^*AZ_m)=\{\lambda_{m,1},\cdots,\lambda_{m,k},\mu_{m,1},\cdots,\mu_{m,l},0_{n-k-l}\}$ where the $\lambda's$ are $>0$ and the $\mu's$ are $<0$. Since $Z_m^*AZ_m$ converges to $diag(0_{n-p},B)$, there is a permutation of $\lambda's$ and $\mu's$ s.t. $\lambda_{m,j}$ converges to $0$ or to a $>0$ eigenvalue of $B$ and $\mu_{m,j}$ converges to $0$ or to a $<0$ eigenvalue of $B$. $\square$.