"O mankind, worship your Lord"—meaning: do not associate anything with Him—"who created you and those before you"—meaning: He created you and created those who came before you; "that you might become righteous"—meaning: so that you may attain righteousness.
﴿يَا أَيهَا النَّاس اعبدوا ربكُم﴾ أَي: لَا تُشْرِكُوا بِهِ شَيْئا ﴿الَّذِي خَلَقَكُمْ وَالَّذِينَ مِنْ قَبْلِكُمْ﴾ يَعْنِي: خَلقكُم وَخلق الْأَوَّلين؛ ﴿لَعَلَّكُمْ تَتَّقُون﴾ أَي: لكَي تتقوا