When file systems store a file, they usually try to store the whole file in one part. When the disk drive fills up, finding an empty space that is large enough becomes more difficult. In such a case, the file systems will split the file into parts, and store each part at a different location on the disk. This process is known as fragmentation. Fragmentation occurs because the different parts are not stored next to one another. When the file is read, it has to be assembled from the different locations. Files that are stored in one part can be read faster.
Defragmentation is the process of rearranging the different parts, so that they are stored next to each other. This is usually done by copying them to a different place on the disk. Defragmentation is relevant to file systems on electromechanical disk drives. To read each part, the head of the hard disk needs to reposition itself to the area where the part is stored.
The problem of defragmentation is that it is takes a long time and in some cases, the file system cannot be changed while it is in progress. For that reason, defragmentation should not be done, when it can be avoided.
There are different kinds of files, some of them are modified more often. It is often a good practice to put them on different partitions, as most Unix-like operating systems do. Also, the design of hard drives has changed over time, which will make the effects of defragmentation less visible.