Dumbledore also knew about the prophecy that Professor Trelawney foretold long before Harry ever came to Hogwarts. He knew that in order to kill Voldemort, Harry likely had to die as well.