1. You already proposed a solution but you're changing redMF's size. You should merge with redChannel's first and last columns and rows.
redMF = medfilt2(redChannel(2:rows-1, 2:columns-1), [3 3]);
greenMF = medfilt2(greenChannel(2:rows-1, 2:columns-1), [3 3]);
blueMF = medfilt2(blueChannel(2:rows-1, 2:columns-1), [3 3]);
redTemp = redChannel;
redTemp(2:rows-1, 2:columns-1) = redMF;
redMF = redTemp;
greenTemp = greenChannel;
greenTemp(2:rows-1, 2:columns-1) = greenMF;
greenMF = greenTemp;
blueTemp = blueChannel;
blueTemp(2:rows-1, 2:columns-1) = blueMF;
blueMF = blueTemp;
This process will maintain image's size for next lines to prevent errors like you had.
2. noiseImage is a binary image with size of the main picture. It's 1 where greenChannel's value is 0 or 255.
noiseFreeGreen(noiseImage) = greenMF(noiseImage);
This line will change only operates where noiseImage pixel's value is 1. This line will replace 0 or 255 value at pixel with corresponding value from median filtered image. Instead of blurring all the picture, it will only focus on the 0 and 255 values.