There are two ways. One is to knit a border on as you are working the scarf. So if you are doing knit one row, purl one row, right from the start you could add something like 5 stitches (entirely depends on how wide your scarf is to begin with) of garter stitch on either side. So you would knit the first and last 5 stitches of EVERY row. That would make a garter stitch border with the rest of the scarf being stockinette.
Or, once the scarf is complete, you could pick up stitches (about 3/4 way down the page that I linked) along the entire length and add a border that way.
Either way, stockinette has a VERY strong tendency to curl, sometimes even with a border added. These are things you can try but there's no guarantee that it is going to work, unfortunately. Also, here is a thread that discusses at length different suggestions that people have for overcoming the problem.