A hard fork is a permanent divergence from the previous version of a blockchain; a new set of consensus rules are introduced into the network that is not compatible with the older network. Under a hard fork, blocks (transactions) that are confirmed by nodes that are not yet upgraded to the latest version of the protocol software will be invalid. Nodes running the older version of the software will have to follow the new set of consensus rules for their blocks to be valid on the forked network.
A hard fork can take place to augment the functionality of a blockchain, increase the security of operating on the network, or even to reverse transactions on the blockchain. With the latter scenario occurring for the Ethereum blockchain, where a hard fork was implemented in order to reverse transactions following a hack on the DAO (Decentralized Autonomous Organization).
A soft fork is a backward compatible method of upgrading a blockchain. Soft forks do not require old nodes to upgrade to maintain consensus, because all blocks on the softforked blockchain follow the old set of consensus rules as well as their new ones. However, blocks produced by nodes conforming to the old set of consensus rules will violate the new set of consensus rules, and as a result, will likely be made stale by the upgrading mining majority. This is because for a soft fork to work, a majority of miners need to recognize and enforce the new set of consensus rules. If this majority is reached, then the older network will fall into disuse, with the newer blockchain gaining recognition as the ‘true’ blockchain.