Ansar al-Islam is listed by the United States as a terrorist organisation and is suspected of carrying out suicide bombings against coalition forces in Iraq.
Brynjar Meling, Krekar's lawyer, said the family had been threatened in the past from "nationalist circles that could be related to his activities in northern Iraq".
"The whole family is shaken," he told Norwegian television news station TV2 Nyhetskanalen.
Krekar, whose real name is Fateh Najmeddin Faraj, admits that he co-founded Ansar al-Islam in 2001, but insists he has not headed it since May 2002.
Police were alerted to the attack, which took place in a working-class neighbourhood of eastern Oslo, at 0054 GMT.
Metlid said "several shots" were fired from a covered walkway outside the fifth-floor apartment.
She said five people - Krekar, his wife, son, daughter and son-in-law - were in the apartment at the time.
Krekar, 53, has lived in the area with his family since 1991.
He was ordered to be deported from Norway in 2005 after the government declared him a national security threat, but authorities have refused to expel him because of the security situation in Iraq.