The Gujarat Animal Preservation Act of 1954 also says the punishment for transporting of cows will be 10 years in jail.
In the current law, which was amended in 2011, the maximum jail term for cow slaughter was seven years. The new law also increases penalty from Rs 1 lakh to 5 lakh.
The bill was passed in the absence of the opposition Congress, which had walked out on some other subject.
Over the past few weeks, Chief Minister Vijay Rupani has often talked about bring in harsher laws to protect cattle. The BJP is committed to protect "Gau (cow), Ganga and Gita", he declared earlier this month. This was days after the ruling BJP won giant victories in state elections, especially in Uttar Pradesh, where the party has appointed as Chief Minister the saffron-robed Yogi Adityanath - one of its loudest cow protection campaigners.
The slaughter and transport of cows was banned in Gujarat in 2011, when the state was ruled by Narendra Modi, now Prime Minister.
The BJP has governed the PM's home state since 1998. As it seeks a fifth consecutive term this year, it faces the challenge of disenchantment among its former supporters the Patels over quota and anger over attacks on Dalits.
The party's slogan "UP mein 325, Gujarat mein 150" (325 seats in UP, 150 in Gujarat) conveys its aim to win Gujarat with a record margin, the sort it won in India's most populous state.