Unless you are in the United States Military, of course you can resign from your job.
Sounds like you have other issues going on here such as immigration or breach of contract concerns. You will need to supply additional details about your specific situation if you want more assistance with your problem....
Unless you have a personal services contract for a specific period of time, you have the right to resign your employment at any time. Labor Code Section 2922 provides that unless the contract is for a specific period, it is "at-will", which means that the employer can fire you and you can resign at any time for any reason, with or without notice.
Indentured servitude violates public policy. You have the right to quit your job anytime. As mentioned in previous answers, if you have a contract you could be liable for damages but they or a court cannot compel you to work there.