softfork is a change to the bitcoin protocol wherein only previously valid blocks/transactions are made invalid. Since old nodes will recognize the new blocks as valid, a softfork is backward-compatible. When a majority of miners upgrade to enforce new rules, it is called a miner-activated softfork (MASF). When full nodes coordinate to enforce new rules, without support from miners, it is called a user-activated softfork (UASF).
A hardfork is a change to the bitcoin protocol that makes previously invalid blocks/transactions valid, and therefore requires all users to upgrade.
Any alteration to bitcoin which changes the block structure (including block hash), difficulty rules, or increases the set of valid transactions is a hardfork. However, some of these changes can be implemented by having the new transaction appear to older clients as a pay-to-anybody transaction (of a special form), and getting the miners to agree to reject blocks including the pay-to-anybody transaction unless the transaction validates under the new rules. This is known as a softfork.
To date, Bitcoin has never deployed a hardfork, but some altcoins have.
SOURCE: bitcoin wiki
hardfork occur when some people supporting that coin is not satisfy to the current protocol.