There is no single answer. The two planets orbit at different speeds, so the distance between them changes every second. Here is what it is at this moment.
Earth takes 365 days to go around the Sun. Mars takes 687. They are on different tracks at different speeds, so sometimes they are on the same side of the Sun and sometimes on opposite sides.
When they line up on the same side — an opposition — the gap can close to about 54.6 million km. When the Sun stands between them, it opens to about 401 million km. That is a factor of seven, and it is why every mission to Mars has to leave in a narrow window that comes around every 26 months.
| Closest possible | about 54.6 million km — light takes about 3 minutes |
|---|---|
| Farthest possible | about 401 million km — light takes about 22 minutes |
| Average | about 225 million km |
| In light years | about 0.0000238 at closest — Mars is far too near for light years to be a useful unit |
| Travel time for a spacecraft | about 7 to 9 months on a normal transfer orbit |
| Launch window | about every 26 months, when the two planets line up |
A command sent to a rover on Mars arrives between about 3 and 22 minutes later, and its reply takes the same again. There is no way to drive it in real time; by the time you saw a rock in front of it, the rover would already have hit it.
That is why the rovers make their own decisions. Curiosity is told where to go, not how to get there. It looks at the ground, picks its own route and reports back afterwards.
The same delay is on the weather data. What the rover measured has been travelling for minutes before anyone on Earth sees it, and NASA publishes it a few sols later still.