Umar was mistaken. The Messenger of Allah ﷺ only forbade deliberately timing prayer to coincide with the rising and setting of the sun.
وهم عمر إنما نهى رسول الله ﷺ أن يتحرى طلوع الشمس وغروبها.
Muslim narrated it in the Book of the Prayer of Travelers (833), from Muhammad bin Hatim, who said, Bahz narrated to us, who said, Wahib narrated to us, who said, Abdullah bin Tawus narrated to us, from his father, from Ayesha, and she mentioned the same.Bayhaqi said (2/453), "She said that only because she saw the Messenger of Allahﷺ pray the two units of prayer after Asr, and this was something established from her and from Umm Salama as something he made up later, since ﷺ whenever he did something, he kept doing it regularly."