Measure the length and width of the space you want the cushion to fill wity your tape measure. Purchase a piece of 4-inch thick high-density foam in that size. High-density foam is available from upholstery supply stores or sewing supply shops, which will cut it to size for you.
Measure and cut two pieces of extra-loft foam batting to be the same size as the foam cushion. Cut one piece of extra-loft batting that is the same length as the perimeter of the foam cushion and 4 inches wide. You will use two pieces of foam batting to cover the top and bottom of the cushion and the long piece to cover the sides.
Apply a light coat of spray adhesive to the top of the foam cushion. Line up the piece of batting on the top of the foam cushion and press it down so the foam batting adheres to the foam cushion. Cover the bottom and sides of the foam pillow the same way.
Measure and cut out two pieces of the fabric to cover the top and bottom of the cushion. Each piece should be 1-1/2 inch longer and 1-1/2 inches wider than the cushion. The extra fabric will be taken up by the seam allowances and will ensure that the cover will fit over the cushion. The seam allowance is the distance from the edge of the cut fabric to the seam.
Measure the perimeter of the top of the cushion with your tape measure. Cut one piece of fabric that length plus 1 1/4 inches and 5 1/4 inches wide. This piece of fabric will cover the sides of the cushion.
Match up the two ends of the long piece of fabric with the right sides of the fabric facing each other. The right side of the fabric is the side that will be on the outside of the cushion cover--it is the side you will see when the cushion is done. Sew the two ends of the long piece of fabric together using a sewing machine. The seam should be 5/8 inch from the edge of the fabric and be parallel to the short end of the long piece of fabric.
Pin the long piece of fabric around the edge of the top of the cushion cover so right sides of the cushion cover top and the long piece of fabric are facing each other. Place straight pins 3 inches apart and perpendicular to the raw (unfinished) edges of the fabric.
Sew the long piece of fabric to the top of the cover with a sewing machine using a 5/8-inch seam allowance and thread that matches the fabric. As the sewing machine's presser foot comes to each pin, remove the pin rather than sewing over it. Cut away the extra fabric at the corners in order to improve the fit.
Using the same technique, sew the other side of the long piece of fabric to the bottom of the cushion cover, leaving an opening on one long side to insert the foam cushion. Put the foam insert into the cushion cover at the opening. Use a needle and thread to hand sew the opening closed, turning under the edge of the fabric for a neat seam.