A car on a jack is usually a very unstable object. Even when if are changing a wheel on a level surface, you should use everything available to stop your car moving when jacked up: handbrake, reverse gear or park, and wedge or stone or brick or whatever.
When the the car direction is more or less aligned with the slope, using everything at hand to secure your car against moving should help you out. It's advisable to always have something rigid enough in your car just for the case that you have a flat on a steep climb on a dessert road (no joke, you'll never have a flat in front of a workshop, that's granted).
On a rare occasion when your car is aligned perpendicularly to the slope, well, then it depends on what side of the car you need to change the wheel. If on the "upper" side, you need to secure your car against motion in both directions (again, with a piece of wood, brick or whatever) and try to position the jack as vertically as possible. And, again, a car jacked up like this will be very, very unstable. If the case is that the flat tire is on the "lower", than the best advice is not to try to jack the car up at all.