Your error stems from a misunderstanding of units. The square root of 1000 mV is not 31 mV (it's either 1 V^(1/2) or 31 (mV^(1/2)), which are both strange, non-physical units.
mW * ohms is (mV * A) * (V/A), so you really have a value of 1000 V*mV, or 1 V^2. Taking the square root yields 1 V. 1 V^2 is likewise the same as 1000000 mV*mV, and taking the square root of that yields 1000 mV, which is consistent.
Working in a dimensionally consistent way we can re-do the calculation with embedded dimensions:
\$P = V_\text{RMS}^2/R\ \implies PR = V_\text{RMS}^2\$, hence \$V_\text{RMS} = \sqrt{20\,[\text{mW}] \cdot 50\,[\Omega]} = \sqrt{1\,[\text V^2]} = 1\,[\text{V}]\$.
\$P = V_\text{RMS}^2/R\ \implies PR = V_\text{RMS}^2\$, hence \$V_\text{RMS} = \sqrt{20\,[\text{mW}] \cdot 50\,[\Omega]} = \sqrt{1000000\,[\text{mV}^2]} = 1000\,[\text{mV}]\$.