How, or where, did "Ye God" become "egad"?

Solution 1:

English has a raft of 'minced oaths' to take the place of the original swear words for the sake of politeness. We still use words like darn, ruddy, and flippin' 'eck.

Egad, as well as zounds, 'sblood, struth, gadzooks, etc. are from Elizabethan times. Plays contained plenty of swearing, but in 1606 all oaths on stage were banned. These minced oaths took their place and come down to us in the surviving printed corpus of Elizabethan works.

Full article on wikipedia: http://en.wikipedia.org/wiki/Minced_oath

Solution 2:

Etymonline lists the 1670s without attribution, Merriam Webster lists 1673, also without attribution, unfortunately. This date seems to be coming from Geoffrey Hughes' Swearing: A Social History of Foul Language, Oaths & Profanity in English, but I do not have a copy, and I can't chase it down any further. You might check your local library for a copy.