If all you need is speed control, you can drive a motor with a PWM pin and a simple transistor circuit. The PWM pin controls the transistor which switches the current to the motor. The higher the PWM duty cycle, the faster the motor will go.
Learn how to build one in Arduino Lesson 13 from the Learning System:
Need to reverse direction too? That requires some more circuitry. The H-Bridge is a 4-transistor circuit that allows you to reverse the current flow to the motor. With an H-Bridge and a PWM pin, you can control both the speed and direction of the motor.
You can learn how to build an H-Bridge circuit using an L293D chip in these Learning System Guides:
Arduino Lesson 15 - DC Motor Reversing.
Raspberry Pi Lesson 9 - Controlling a DC Motor.
The Adafruit Motor Shield V2 is an off-the-shelf solution capable of powering brushed DC motors up to 1.2A continuous (3A peak) at up to 12v.
Learn how to use this shield for DC motors in the Adafruit Motor Shield V2 Guide in the Learning System Guide
The nice thing about the shield is it handles all the PWM speed control on its own, and uses only the two shared I2C pins to control motors. It's also stackable so you can add more shields as desired to control more motors without taking up any more pins.