Rafiq, 25, has played with Yorkshire's second team recently and is now able to play in all formats for the county.
Meanwhile, seamer Josh Shaw, 20, has been recalled from his loan spell at Gloucestershire with immediate effect.
"Josh's loan spell has helped with his development and this is clear to see from the wickets that he has taken," said director of cricket Martyn Moxon.
Shaw has taken 19 first-class wickets so far this season for Gloucestershire.
Rafiq first played for Yorkshire as a teenager in 2008, and stood in as captain in 2012, but was released at the end of the 2014 season.
Moxon added: "With Liam Plunkett and David Willey being called up to the England one-day international squad and, with injuries to Ryan Sidebottom, Matthew Fisher and Jack Brooks, our seam bowling resources are stretched.
"An option is in place for Josh to return to Gloucestershire at some stage during the season."
Pakistan-born all-rounder Azeem Rafiq has signed a contract with Yorkshire until the end of the season.