While writing a melody over a bass line, it is generally advised to have the melody & the bass line moving in contrary motion to each other. I want to know if such a rule also exists when you write for SATB. Do the Soprano & Bass have to move contrary to each other, just like the melody & bass line?
I'm reminded of that quote from the US version of The Office: "What's the safest way to go skiing? Don't ski!"
The rule suggesting contrary motion isn't because there's anything inherently better about contrary motion. Rather, it's that contrary motion is a means to an end in preventing forbidden parallels like parallel perfect fifths and octaves. Contrary motion isn't required; if you don't have contrary motion and you're not breaking any part-writing rules, then your voice leading is fine.
Although you do not have to have contrary motion at all times, there will be occasions when you need contrary motion between the soprano and the bass. Let's say you're moving V to vi and the soprano has scale-degree 2 above the V chord. This soprano can't move to scale-degree 3, because that would be parallel perfect fifths with the bass. As such, you need to move the soprano down to scale-degree 1 in contrary motion to the bass.
But instead of memorizing all similar instances where this would be the case, it's much much easier to just watch for and prevent forbidden parallels.
Same as 2 part writing really. Contrary motion between the outside parts is the extreme opposite of naughty consecutives! (I'm not saying that parallel motion WILL always cause consecutives!) You don't have to do it ALL the time. But it's useful when a 'full' harmony is the aim. (But remember, you don't always want to sound like a 19th century hymn tune).
As always, when discussing traditional SATB writing, consult the Bach chorales. You'll see that there is both contrary and parallel motion between the outside parts. Contrary motion isn't a 'rule'. It isn't even 'generally advised'. But if the aim is to write independent parts, it's good if they don't always follow each other in parallel.
Contrary motions in harmony exercises are good because they remove the chance for parallel fifths and octaves to a great degree. Off course you can have passages move in parallel but you need to be sure you don't commit the offense of parallel 5ths / octaves.
Generally having your voices move in parallel is a bit more of an advanced way of doing harmony, not impossible, it is just if you want to get the newbies over the hump of learning the basics it is often just easier to tell them to avoid it.