Yes it does matter, though to what extent is going to be dependent upon the vehicle in question. To get a proper dipstick reading, the car should be on level ground and in most cases without the engine running.
The reasons why it matters is because every engine has an oil pan/sump (note: we'll not talk about dry sumps in this instance). The sump may be of different levels and/or position relative to how the engine sits in the vehicle. Some engines sit front to rear in the engine bay, where the sump could be to the front or to the back of the engine. If the car were on an uphill slant with the sump in the front, some of the oil may have drained to the rear of the pan where the dipstick won't pick up a proper read and may appear low. With the same engine, where the vehicle is pointing downhill, the oil level may appear high.
There are a lot of reasons why the reading may be off if the vehicle is not sitting on level ground. Making sure the vehicle is as level as possible will give you the best results, though sometimes it may not be available and you'll have to make due.