As the link you posted from another question explain, in the position representation $\psi(x)$, the eigenvectors with eigenvalues $\hbar k$ of the momentum operator $\hat{p}=\frac{\hbar}{i}\frac{\partial}{\partial x}$ are functions of the form $\psi_k(x)=e^{ikx}$. If we want the probability distribution for the measurement of some observable $O$ in a given state, we need to perform the spectral decomposition $O=\int k dP_k$, where $P_k(\cdot)=\psi_k(\psi_k,\cdot)$ is the projector in the eingespace of eigenvalue $k$ (I assumed that the eigenvalue is non-degenerate for simplicity, but the same also holds for the general case). Then the probability distribution will be given by $p(k)=(\psi, P_k \psi)$. So, for the case of the momentum operator, we have the probability distribution $$p(k)=(\psi,\psi_k)(\psi_k,\psi)=|(\psi_k,\psi)|^2=\left|\int e^{-ikx}\psi(x)dx\right|^2=|\tilde{\psi}(k)|^2,$$ where $\tilde{\psi}(k)$ is the Fourier transform of $\psi(x)$.