Lay the sole on the back piece(or vice versa).
Set your sewing machine on the widest zigzag stitch it makes.
Thread tension can be low, stitch length long.
The type of thread doesn't matter.
Sew along the edge of the cloth so the needle straddles the edge of the cloth on every zag.
That will bind the edge of the seam.
Pull on the cloth as shown to stretch it. That will make a seam that also stretches when it is done.