Lee did not march into Pennsylvania to dig in. He knew he had to have a decisive victory.
Lee marched into Pennsylvania because: [a]He did not want to be re-deployed to Tennessee with the bulk of his army [a plan being bandied about in Richmond], [b] He wanted to take the pressure off the farms of Northern Virginia for the summer of 1863, [c] He wanted to live off the agricultural bounty of Pennsylvania for a season.
Lee’s 1863 campaign was a raid, plain and simple. It only became an invasion after he got his butt kicked.