The 27-year-old centre-back, who can also operate as a midfielder, was released by the Millers this summer following an injury-ravaged season in south Yorkshire.
He joins North End on the back of a successful trial period and previously played under boss Graham Westley at Stevenage in the 2010/11 season.
Foster will make his debut in Tuesday night's Johnstone's Paint Trophy Northern Area quarter-final at Bury after being named in the starting line-up in place of the suspended Chris Robertson.
- Sports & Recreation
- Graham Westley