There are two primary methods for your Twitter account to become compromised. Either you authorized a malicious application to connect to your account, or your password was guessed/stolen.
The first thing to do as soon as you notice a problem is to scan your system with an up to date anti-virus product to be sure your machine isn't infected and doesn't have a keylogger installed.
Next you need to set a new password. As always we recommend selecting a strong password that is unique for each website.
Complete article:
http://nakedsecurity.sophos.com/2012/01/28/what-do-i-do-if-my-twitter-account-is-hacked/