You've hit on one of those wonderful terms that is not transparent to the learner, yet used on a daily basis by some people. :)
Please note that it isn't too hard to find this in a dictionary. In fact, it's also on Wikipedia. Consider checking available resources before asking a new question.
It does refer to the boards of lumber used to frame the wall, as is commonly done in North America. (It would be surprising if they were in a pile. We don't associate piles with uniformity and order.) Each plank is two inches thick, four inches wide, and a variable number of feet long.
You can also generalize this term: 2x6, 4x4, etc. The first number is always the thickness of the plank and the second one is the width, both measured in inches.
Sometimes there's a third number: 2x4x8. The third one is the length, and is measured in feet, at least in North America. (Including here in Canada, despite our affinity for the metric system!)
As the Wikipedia blurb mentions, though, in reality these boards are half an inch less in both thickness and width, an amount lost during sizing and planing. (This is also true of other sizes than 2x4, but as Jasper mentions in the comments, the amount differs depending on the original size of the board and the country in which this is taking place.)
At the store your question might be: "Can I get a couple of six-foot two-by-fours in spruce?"
Here's a picture of two-by-fours from Home Depot's website:

Jasper has shared this picture from R&B Builders of what the inside of such a garage might look like. The two-by-fours are the vertical boards (studs) on the right and the horizontal boards at the top and bottom of the frame:
