I'm guessing you are interested in the median as a way to smooth or remove outliers from the image you are working with? If so you might want to look at digital filtering methods rather than moving windows for outlier detection and removal. These methods are related of course, but there are differences between band limited filtering as opposed to moving windows and convolution methods. See the link below for a nice example illustrating the differences.
Thank you John W. Kern for your reply and correctly defining my problem!
Zonal statistics plug-in in QGIS compute mean of the raster. However for my research, I am interested in median elevation for each county (district). I used GRASS but could not get values in attribute table as zonal stat tool normally does.
As others have noted, the plugin will depend in part on the version of QGIS but one of the nice things about this free program is the wealth of plugins that have been developed. the Zonal Grid statistics should do it.