Your question is not very clear. When a US citizen sponsors an alien, you have to sign and file I-864 affidavit of support, which potentially exposes you to financial obligations in case your spouse does not work and becomes a public charge. Divorce does not free you from such obligations. Now, it does not matter whether the alien is legal or not (I assume here that by term illegal you mean someone who is out of status but entered US legally) - obligation is the same.
It is not clear what you mean by "trouble". You are responsible for not defrauding US government in your petition, i. e. not lying or misrepresenting facts. Also, your relationship has to be bona fide - meaning a real relationship. If by trouble you mean unrelated to immigration future criminal acts done by the immigrant - no, you are not responsible for those, unless these actions are already taking place and you are aware of that. Goos luck!