The Alabama House of Representatives and Senate passed the legislation after a controversial ruling by the state's Supreme Court.