I think you mean consciousness, or do you mean conscience? If it's the latter, then that's virtually the same question as where did our morality come from (morality evolving within us as we were small hunter gatherer tribes - I'll scratch your back you scratch mine type of thing that is explained in many other threads here). If you mean consciousness, that is what cognitive science is attempting to define and explain. It's a fascinating subject! Dennet, Harris, Hofstadter, Pinker and others all dabble in cognitive science, and there are differing hypotheses of how we discovered consciousness. One train of thought originates from a Princeton professor, Dr. Julian Jaynes, in his book, 'The Origin of Consciousness in the Breakdown of the Bicameral Mind'. In it, he states that humans were not always conscious, and that it is a fairly recent human discovery. His definition of consciousness is very specific, and he explains what consciousness is necessary for, and what it is not (learning, routine tasks, etc.) He demonstrates how the human two chamber (or Bicameral) mind was not always conscious, and that the discovery would only be made after complex enough language was developed. Language advanced enough to use metaphor - using a known thing to explain an unknown thing, and generate analog models - this map/grid represents its corresponding location or area of space. He goes on to demonstrate that entire ancient civilizations were built without humans being conscious: Egypt, Mesopotamia, even very ancient Greece. He points to their writings being simply a reporting of events and devoid of introspection and self-analysis (example - the Iliad's prose being an objective reporting of events, and the Odyssey written centuries later showing subjectivity and introspection). Although some of Jaynes' hypotheses are now obsolete (the book was written in the 70's), many have been used to lay the foundation of modern cognitive science, and he was a pioneer. Anyway, I would suggest reading Pinker's, 'How the Mind Works' and Hofstadter's, 'I Am a Strange Loop'. Or better yet listen to the Pinker book on Youtube:
[video=youtube;vuwNfPca_Pw]http://www.youtube.com/watch?v=vuwNfPca_Pw[/video]