Is Islam a punishment for Abraham sleeping with his slave?
I assume you are referring to Abraham's relationship with his wife Sarah's maid, Hagar, which resulted in the birth of a son, Ishmael, and the subsequent banishment of Hagar and Ishmael after the birth of Abraham and Sarah's son, Isaac (see Gen. 16, 21). While Ishmael is honored in Islam as a prophet and patriarch, he was not the founder of Islam nor responsible for its existence.
Islam began in the seventh century A.D. as a result of claims made by its prophet, Muhammad, to have received revelations from God. It would therefore be false to suppose that the existence of Islam is a "punishment" for Abraham's actions. For more information, I recommend reading the Catholic Answers booklet 20 Answers: Islam.