On September 22, 1862, President Lincoln announced to his cabinet that he was going to issue the Emancipation Proclamation. He had previously read his draft of the Proclamation to them and gotten their reaction on July 22nd of that year. The Proclamation did not go into effect until January 1, 1863.
Lincoln came up with the idea sometime in the Spring of 1862. At that point, the war was not going very well at all. Lincoln thought that emancipating the slaves would hurt the South economically and militarily. However, he did not want to issue the Proclamation until the war started to go a bit better for the North.
So, in answer to your question, President Lincoln came up with the idea of the Proclamation very early in the war and it went into effect on January 1, 1863.