The 27-year-old former Newport man was a crucial cog in the Glovers side that clinched promotion to the Championship last season but has been restricted to just seven appearances this term.
"I spoke to Gary Johnson about him and he came on the radar a week or two ago so I've been doing some checks on him," said manager Mike Jackson, who could hand Foley his debut against Bristol City on Saturday.
"He's scored goals for Newport and he did for Yeovil last season. I was impressed when he played for Yeovil last year and he's been part of a promotion team which is always good.
"He's got an energy about him and he can play off the left, off the front, so he gives us a few options. It will be competition for places again so I'm made up he's here."