Compulsion (PHB p.224)
Until the spell ends, you can use a bonus action on each of your turns to designate a direction that is horizontal to you. Each affected target must use as much of its movement as possible to move in that direction on its next turn.
A target isn’t compelled to move into an obviously deadly hazard, such as a fire or pit, but it will provoke opportunity attacks to move in the designated direction.
You may designate any direction on the horizontal plane which is defined as being perpendicular to the caster's local gravity (when concerned with such things, such as on different planes with varying gravity directions). Then the target uses as much of its movement as possible to move in that direction.
The spell does not restrict the target using movement in any way beyond using as much as possible in the attempt to move in the direction chosen. If it must go up or downhill, climb over a wall, walk round a fire, swim, fly or crawl to be able to move in that direction, it will use as much of its movement as possible to do so. The only restriction is that it won't do things such as walk off a cliff or through the Wall of Fire. However it will risk OAs to maximise the distance moved in the chosen direction.
So just because the target is standing on a slope (or the caster is up a wall or flying or even ethereal) and you choose a direction that would lead it downhill towards from the caster (for instance) that does not stop the target from moving in that direction, it just moves vertically down as well as moving horizontally away.