Jackson died from wounds he received at the Battle of Chancellorsville. Jackson and a small group of men rode behind enemy lines to survey the situation. Upon returning to his front line, the pickets mistook his group for the enemy, and fired upon them. Jackson was shot three times, although his wounds did not appear to be life threatening. As they were carrying him away on a stretcher, one of the medics was shot, and Stonewall was dropped, compounding his injuries. At first it looked like he would survive his injuries, but after his arm was amputated, he began to go down quickly. On Sunday, May 10, 1863, it was clear that he would not make it. He had some time to visit with his wife, and then he began to slip out of consciousness. As he was drifting off, he began to issue orders to General A. P. Hill. His last words were, "Let us cross over the river, and rest under the shade of the trees". I find it interesting that both General Robert E. Lee and Stonewall Jackson, in their last moments, were calling out to General A.P. Hill.
This link is to an original newspaper article withh the obituary of Stonewall Jackson.