The Prophet ﷺ said: If any Muslim dies and three rows of Muslims pray over him, it will assure him (of Paradise). When Malik considered those who accompanied a bier to be a few, he divided them into three rows in accordance with this tradition.
قَالَ رَسُولُ اللَّهِ ﷺ مَا مِنْ مُسْلِمٍ يَمُوتُ فَيُصَلِّي عَلَيْهِ ثَلاَثَةُ صُفُوفٍ مِنَ الْمُسْلِمِينَ إِلاَّ أَوْجَبَ قَالَ فَكَانَ مَالِكٌ إِذَا اسْتَقَلَّ أَهْلَ الْجَنَازَةِ جَزَّأَهُمْ ثَلاَثَةَ صُفُوفٍ لِلْحَدِيثِ