There's no set time. Long enough so that he/she feels they know you well enough to write a great LOR. The longer the better.
I shadowed a DO all the way up until matriculation, and I'll shadow him again when I go back for Christmas. To me, it's a great experience, and a good way to make possible future contacts, especially if you plan on practicing there in the future.