The bill was approved in the second and third readings by 61-41 votes, making it an effective law.
The legislation is widely seen to be targeting Arab citizens of Israel and Palestinian residents of the occupied East Jerusalem.
The law did not specify where families or relatives would be deported. Yet, Israeli media says that Gaza will be a destination for those being deported.
The new law gives power to the interior minister to decide which relative will be expelled if the ministry provides evidence that a family member had prior knowledge of an attack, or if a family member voices support for an attack against Israelis.
A Knesset statement said that under the law, the deportation period for a person who holds Israeli citizenship may range between 7-15 years, and between 10-20 years for a person who holds a legal residence permit.
There was no immediate Palestinian comment on the controversial law.
On Tuesday, the Israeli Knesset passed a similar law allowing the sacking of Arab teachers who show support for attacks against Israelis.
Tension has escalated across the Palestinian territories over Israel’s brutal offensive on the Gaza Strip, which has killed nearly 43,400 people, mostly women and children, since a Hamas attack last year.
Israel faces a genocide case at the International Court of Justice for its actions in the blockaded enclave.