Allah Ta'ala said,

ووهبنا لداوود سليمان نعم العبد إنه أواب (30) إذ عرض عليه بالعشي الصافنات الجياد (31) فقال إني أحببت حب الخير عن ذكر ربي حتى توارت بالحجاب (32) ردوها علي فطفق مسحا بالسوق والأعناق (33)

"And We gave David, Solomon, his best servant. Surely he is very (to God). (Remember) when it was shown to him the horses that were calm at the time of stopping and fast when running in the afternoon, he said: "Surely I like the pleasure of good things (horses) so that I neglect to remember my Lord until the horse is gone from sight" . "Bring all the horses back to me." Then he cut the horse's legs and neck. "(Shaad: 30-33).

Allah mentioned, that He bestowed upon David the son named Solomon `alaihis salam. God praised Solomon that he returned to Him a lot, then God mentioned the matter about horses. Here's the story:

Sulaiman `alaihis greetings once his love for horses is used jihad in the way of Allah. He has horses that are strong, fast and winged. The horses are 20 thousand. When he checked and arranged the horses, he missed the Ashar prayer because he forgot, not on purpose. When he learned that he had missed praying because of the horses, he swore, ‘No, for the sake of Allah, do not you (my horses) neglect me from worshiping my Lord. 'Then he ordered that the horses be slaughtered. So he struck the horses' necks and veins with a sword. When God found out that His servant Solomon was slaughtering the horses because of Himself, out of fear of His torment and because of His love and glorification, because he was busy with the horses so the prayer time was finished. For this reason, God then replaced him with something better than the horses, namely the wind that could blow with his orders, so that it would become the fertile area he passed, his journey a month and return a month. And of course, it's faster and better than a horse. Therefore, it is true that the words of the Prophet sallallaahu 'alaihi wasallam,

رنَّكَ لاَ تَدَعُ شَيْئًا إِتِّقَاءً لله تَعَالَى إِلاَّ أَعْطَاكَ اللهُ عَزَّ وَجَلَّ خَيْرًا مِنْهُ) رواه أحمد و البيهقي)

"Surely you do not leave something out of fear of Allah unless Allah will give you (something) better than it." (Narrated by Ahmad and Al-Baihaqi, saheeh hadith).