Back in the day, I made a bunch using used railroad ties but since they are soaked with creosote, I wouldn't recommend it anymore. These days I use rot resistant wood like cedar, redwood, osage orange, etc. On a slope, I typically don't even bother with the back side and just make it even to the slope. I essentially build a three sided box and sink the sides into the uphill side so that everything is level. Their are a couple advantages to this method. Less materials and labor and the raised bed tends to dry out more slowly than a completely raised bed since only part of it is above ground.