Looks like you can’t get the pixels per inch (ppi) of the screen with JavaScript.
If you could then this would be the calculation.
Meters = Pixels*ppi* 0.0254
Best we can do is illustrated by this site
ruler.onl
Basically there needs to be a calibration step where the user has to input the measurement of the screen.