In cryptocurrencies, varied parties need to use common rules to maintain the history of the blockchain. A fork refers to a situation when a rule change occurs.  Forks have been used in cryptocurrencies in order to add new features to a blockchain or to reverse the effects of hacking or catostrophic bugs on a blockchain as was the case with the bitcoin fork on 6 August 2010  or the fork between Ethereum and Ethereum Classic. Notably, blockchain forks have been widely discussed in the context of the bitcoin scalability problem.
Forks are related to blockchain splits. As a result of a rule fork, a blockchain can split, i.e. diverge into two separate paths forward. 
Types of forks
Forks can be classified as soft forks or hard forks.
A hard fork is a rule change such that the software enforcing the old rules will see the blocks adhering to the new rules as invalid. To prevent a blockchain split, all nodes running the old software shall upgrade to new rules.  Alternatively, all nodes using the new software shall return to the old rules as was the case of bitcoin split on 12 March 2013. 
Ethereum has hard-forked to "make whole" the investors in The DAO, which had been hacked by exploiting a vulnerability in its code.  In this case, the fork resulted in a split creating Ethereum and Ethereum Classic chains. In 2014 the Nxt community was asked to consider a hard fork that would have led to a rollback of the blockchain records to mitigate the effects of a theft of 50 million NXT from a major cryptocurrency exchange. The hard fork proposal was rejected, and some of the funds were recovered after negotiations and ransom payment. 
In contrast to a hard fork, a soft fork is a change of rules that creates blocks recognized as valid by the old software, i.e. it is backwards-compatible.  As for a hard fork, a soft fork can also split the blockchain when non-upgraded software creates blocks not considered valid by the new rules. 
A user-activated soft fork (UASF) is a controversial idea that explores how to perform a blockchain upgrade that is not supported by those who provide the network's hashing power.