All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Allah Says (what means): {Mothers may breastfeed their children two complete years for whoever wishes to complete the nursing [period].} [Quran 2: 233]
The interpreters of the Quran are of the opinion that though the phrasing of this verse is in the form of statement, it denotes imperative meaning.
The Muslim scholars have various opinions concerning this order, whether is it an obligatory act or a desirable one. There are three opinions concerning this matter.
A) The order of breastfeeding is only for desirability.
B) It is an obligation if the marriage contract continues.
C) It is an obligation on women to breastfeed their children whether the marriage contract continues or not.
The second opinion is the most correct one. Therefore, a mother should carry out the job of breastfeeding if there is no legal excuse, such as sickness or not having the milk, etc.
Allah Says (what means): {And if they breastfeed for you, then give them their payment and confer among yourselves in the acceptable way…} [Quran 65: 6]
This verse deals with the matter of a divorced woman and proves that breastfeeding is not compulsory for her. Also, it is compulsory for a divorced woman to suckle her baby if he/she does not accept any other woman or when the father is missing.
Kash-Shaaf Al-Qinaa' reads: “If there is no other woman who can suckle a baby, or he/she [i.e. the child] does not accept other than his/her mother, then, in this case, it is obligatory on her to suckle her baby because protecting a living being is a very important obligation.”
As per our knowledge, there is no basis for the statement mentioned in the question that a snake would bite the breast of a mother who does not suckle her baby.
Allah knows best.