Yahya was commanded by Allaah with Tawheed, singling out Allaah with all worship, without ascribing partners to Him.
Imam Ahmad narrated that Al-Harith Al-Ash’ari said that the Prophet of Allaah sallallaahu alaihi wa sallam said:
Allaah commanded Yahya bin [son of] Zakariya to implement five commands and to order the Children of Israel to implement them, but Yahya was slow in carrying out these commands.
‘Isa (Jesus, son of Mary) said to Yahya, ‘You were ordered to implement five commands and to order the Children of Israel to implement them. So either order, or I will do it.’
Yahya said, ‘My brother! I fear that if you do it before me, I will be punished or the earth will be shaken under my feet.’
Hence, Yahya bin Zakariya called the Children of Israel to Bayt Al-Maqdis (Jerusalem), until they filled the Masjid. He sat on the balcony, thanked Allaah and praised him and then said, ‘Allaah ordered me to implement five commandments and that I should order you to adhere to them.
The first is that you worship Allaah alone and not associate any with Him.
The example of this command is the example of a man who bought a servant from his money with paper or gold. The servant started to work for the master, but was paying the profits to another person. Who among you would like his servant to do that? Allaah created you and sustains you. Therefore, worship Him alone and do not associate anything with Him.
I also command you to pray, for Allaah directs His Face towards His servant’s face, as long as the servant does not turn away. So when you pray, do not turn your heads to and fro.
I also command you to fast. The example of it is the example of a man in a group of men and he has some musk wrapped in a piece of cloth, and consequently, all of the group smells the scent of the wrapped musk. Verily, the odor of the mouth of a fasting person is better before Allaah than the scent of musk.
I also command you to give charity. The example of this is the example of a man who was captured by the enemy. They tied his hands to his neck and brought him forth to cut off his neck. He said to them, ‘Can I pay a ransom for myself?’ He kept ransoming himself with small and large amounts until he liberated himself.
I also command you to always remember Allaah. The example of this deed is that of a man who the enemy is tirelessly pursuing. He takes refuge in a fortified fort. When the servant remembers Allaah, he will be resorting to the best refuge from Satan.
Source: Tafsir Ibn Kathir, Volume 1, Ayah 21, Surah Baqarah, Dar-us-salam publications