Manager Bruce Bochy said Tuesday that Cain is scheduled to start Thursday against the Miami Marlins. Cain hasn't pitched since July 2014. He underwent elbow surgery last year and has been sidelined this season with a strained flexor tendon.
Peavy, out since April 17 with a strained back, is to start Friday at Washington.
Cain will replace right-hander Tim Lincecum, who will be placed on the disabled list with a bruised right forearm after being hit by a line drive Saturday.
Bochy said the Giants decided against giving Peavy another rehab start in the minors before activating him.