Yup, kind of....
It depends on the overall rolling radius of the wheel and tyre combination, not just the rim size itself.
If you go from, say, a 16" wheel to a 17" wheel on a lower profile tyre it is possible to keep the overall radius the same, thus not affecting your speedo.
But if you go from a 16" wheel to an 18" wheel it's much harder to do this so your speedo might be out. You'll end up on tiny thin tyres to try and match the radius which will ruin the ride.
It is possible to have your speedo calibrated though so it displays the correct speed regardless of the new wheels. That's a main dealer job though.
HTH