Note: The following is mainly from an answer sheikh Hamza Maqbul gave to a questioner.
Why do we avoid public affection with our spouses? There’s a deep wisdom behind this.
Not everybody is married or can get married. There are many people out there, Muslims or otherwise, who want to get married but are not able. Or they’re searching and haven’t yet found. Many have been searching for years. When they see a married couple holding hands, kissing, hugging, etc., it may elicit an inner pain for them that they don’t have this kind of relationship that they want. Aside from the possibility of incurring ‘ayn or hasad (العين أو الحسد), we don’t want to cause any kind of pain to anyone who may be around us, even if it may not be outwardly visible on them.