The main purpose of getting the MD5 sum of a string is to ensure its integrity and authenticity. By comparing the MD5 hash values of two strings (e.g., the original one and a modified one), we can determine whether they are identical or not. MD5 hashes are also used for password storage, digital signatures, and other security-related applications.