Did you search raised bed gardening online? There are more ideas/materials then you can shake a stick at. I used the 4"X8"X16" concrete blocks. Not as wide as regular concrete blocks and they don't rot. It was cheaper than pressure treated lumber when I did it.
I like railroad ties. I go two ties high, stagger the joints. I took pieces of old conveyor belt and fastened around the inside corners with stainless screws. The expansion from freezing ground in the winter never pushes out the beds, as it will when you simply nail treated boards together.
ive used 2x6 that were left overs, it depends how much you wanna spend and how long you want them to last. cheap pine works but wont last very long in the elements untreated and if your growing veggies to eat you dont want to treat it. cedar is little pricey but would be the best bet in my opinion, for several reasons one cedar has natural oils in the wood that helps prevent rotting over a longer period of time, it also acts as somewhat of a repellent to insects which is why alot of chest are made from cedar. Wood tho no matter the type will all begin to rot away but the cedar would be your best bet. I have actually even used an old feeding bin form the old cow pen to put dirt in i drilled holes in the bottom lined it with geo textile cloth and filled it up and grew radish and beets in it, my grandpa now has asparagus in it.
Still not sold that todays "ACQ" lumber is really safe but yes a lot better than the old stuff. Regardless, any wood that holds the soil in will work ... just depends on how long it will last. 2" thick non treated will last years. Treated wood will rot in this application as well but should last longer.
I just made 8 raised beds this last weekend, I made some out of 2X10's that i had laying around but the bulk of them were made from 6'cedar fence pickets that i found at Homedepot. they are 6' long, 6" wide. they are pickets so you have to cut off about an inch so they are square. $3 each means that you can make a 3' X 6'X 6" deep bed for $10 once you include the 2X2's for the corners.