She could have eaten grass or my cat get foamy at the mouth if she feels threatened by something.
Hacking up mucous could also be the result of a lung or viral respiratory infection. The mucous from the cold/infection doesn't settle well in the stomach and is often vomited.