Given a sample of n units out of a population of N, population median can be estimated by the sample median.
How can we get the variance of this estimator?
The variance of the sample median depends on the distribution you are sampling from. If you know the sampling distribution you can use the distribution of order statistics to find the distribution of the median and thence its variance.
If you don’t know and don’t want to make assumptions about the distribution, then you can do something like bootstrapping to estimate the variance.