Summarize this article:

You will need this gap to slide the elastic through. When sewing the hems, try to sew as close to the raw/cut edge as you can, so that you will have enough space for the elastic. When you are done, pull the sewing pins out. Be sure to tie the ends of the threads off into tight knots and to snip them off, as close to the fabric as you can. Try to use a stitch intended for sewing stretchy fabrics. It usually looks like a straight stitch, but is broken up by V-shapes.
Sew the top and bottom hems, but leave a ½ inch (1.27 centimeters) wide gap on the top hem.