Tafsir Ibn Kathir -> Surah Al-Baqarah -> Fitam (weaning) occurs by Mutual Consent

Allah said:

﴿ظپظژط¥ظگظ†ظ’ ط£ظژط±ظژط§ط¯ظژط§ ظپظگطµظژط§ظ„ط§ظ‹ ط¹ظژظ† طھظژط±ظژط§ط¶ظچ ظ…ظ‘ظگظ†ظ’ظ‡ظڈظ…ظژط§ ظˆظژطھظژط´ظژط§ظˆظڈط±ظچ ظپظژظ„ط§ظژ ط¬ظڈظ†ظژط§ط­ظژ ط¹ظژظ„ظژظٹظ’ظ‡ظگظ…ظژط§﴾

(If they both decide on weaning, by mutual consent, and after due consultation, there is no sin on them.)

This Ayah indicates that if the father and the mother decide on the Fitam (weaning) before the two years (of suckling) end, and for a benefit that they duly discuss and agree upon, then there is no sin in this case. So, the Ayah indicates that one parent is not allowed to make this kind of decision without duly consulting the other parent, as stated by Ath-Thawri. The method of mutual consultation protects the child's interests. It is also a mercy from Allah to His servants, for He has legislated the best method for parents to rear their children, and His legislation guides and directs the parents and the children to success. Similarly, Allah said in Surat At-Talaq (chapter 65 in the Qur'an):

﴿ظپظژط¥ظگظ†ظ’ ط£ظژط±ظ’ط¶ظژط¹ظ’ظ†ظژ ظ„ظژظƒظڈظ…ظ’ ظپظژظ€ظژط§طھظڈظˆظ‡ظڈظ†ظ‘ظژ ط£ظڈط¬ظڈظˆط±ظژظ‡ظڈظ†ظ‘ظژ ظˆظژط£ظ’طھظژظ…ظگط±ظڈظˆط§ظ’ ط¨ظژظٹظ’ظ†ظژظƒظڈظ…ظ’ ط¨ظگظ…ظژط¹ظ’ط±ظڈظˆظپظچ ظˆظژط¥ظگظ† طھظژط¹ظژط§ط³ظژط±ظ’طھظڈظ…ظ’ ظپظژط³ظژطھظڈط±ظ’ط¶ظگط¹ظڈ ظ„ظژظ‡ظڈ ط£ظڈط®ظ’ط±ظژظ‰﴾

(Then if they give suck to the children for you, give them their due payment, and let each of you accept the advice of the other in a just way. But if you make difficulties for one another, then some other woman may give suck for him (the father of the child).) (65:6)

Allah then said:

﴿ظˆظژط¥ظگظ†ظ’ ط£ظژط±ظژط¯طھظ‘ظڈظ…ظ’ ط£ظژظ† طھظژط³ظ’طھظژط±ظ’ط¶ظگط¹ظڈظˆط§ظ’ ط£ظژظˆظ’ظ„ظژظ€ط¯ظژظƒظڈظ…ظ’ ظپظژظ„ط§ظژ ط¬ظڈظ†ظژط§ط­ظژ ط¹ظژظ„ظژظٹظ’ظƒظڈظ…ظ’ ط¥ظگط°ظژط§ ط³ظژظ„ظ‘ظژظ…ظ’طھظڈظ… ظ…ظ‘ظژط¢ ط،ظژط§طھظژظٹظ’طھظڈظ… ط¨ظگط§ظ„ظ’ظ…ظژط¹ظ’ط±ظڈظˆظپظگ﴾

(And if you decide on a foster suckling-mother for your children, there is no sin on you, provided you pay (the mother) what you agreed (to give her) on a reasonable basis.) meaning, if the mother and the father both agree that the father assumes custody of the child due to a circumstance that compels her or allows him to do so, then there is no sin in this case. Hence, the mother is allowed to give up the child and the father is allowed to assume custody of the child. The father should kindly give the mother her expenses for the previous period (during which she reared and suckled the child), and he should seek other women to suckle his child for monetary compensation. Thereafter, Allah said:

﴿ظˆظژط§طھظ‘ظژظ‚ظڈظˆط§ظ’ ط§ظ„ظ„ظ‘ظژظ‡ظژ﴾

(And fear Allah) meaning, in all of your affairs,

﴿ظˆظژط§ط¹ظ’ظ„ظژظ…ظڈظˆط§ظ’ ط£ظژظ†ظ‘ظژ ط§ظ„ظ„ظ‘ظژظ‡ظژ ط¨ظگظ…ظژط§ طھظژط¹ظ’ظ…ظژظ„ظڈظˆظ†ظژ ط¨ظژطµظگظٹط±ظŒ﴾

(And know that Allah is All-Seer of what you do.) meaning, none of your affairs or speech escapes His perfect Watch.

﴿ظˆظژط§ظ„ظ‘ظژط°ظگظٹظ†ظژ ظٹظڈطھظژظˆظژظپظ‘ظژظˆظ’ظ†ظژ ظ…ظگظ†ظƒظڈظ…ظ’ ظˆظژظٹظژط°ظژط±ظڈظˆظ†ظژ ط£ظژط²ظ’ظˆظژط¬ظ‹ط§ ظٹظژطھظژط±ظژط¨ظ‘ظژطµظ’ظ†ظژ ط¨ظگط£ظژظ†ظپظڈط³ظگظ‡ظگظ†ظ‘ظژ ط£ظژط±ظ’ط¨ظژط¹ظژط©ظژ ط£ظژط´ظ’ظ‡ظڈط±ظچ ظˆظژط¹ظژط´ظ’ط±ظ‹ط§ ظپظژط¥ظگط°ظژط§ ط¨ظژظ„ظژط؛ظ’ظ†ظژ ط£ظژط¬ظژظ„ظژظ‡ظڈظ†ظ‘ظژ ظپظژظ„ط§ظژ ط¬ظڈظ†ظژط§ط­ظژ ط¹ظژظ„ظژظٹظ’ظƒظڈظ…ظ’ ظپظگظٹظ…ظژط§ ظپظژط¹ظژظ„ظ’ظ†ظژ ظپظگظ‰ ط£ظژظ†ظپظڈط³ظگظ‡ظگظ†ظ‘ظژ ط¨ظگط§ظ„ظ’ظ…ظژط¹ظ’ط±ظڈظˆظپظگ ظˆظژط§ظ„ظ„ظ‘ظژظ‡ظڈ ط¨ظگظ…ظژط§ طھظژط¹ظ’ظ…ظژظ„ظڈظˆظ†ظژ ط®ظژط¨ظگظٹط±ظŒ ﴾

(234. And those of you who die and leave wives behind them, they (the wives) shall wait (as regards their marriage) for four months and ten days, then when they have fulfilled their term, there is no sin on you if they (the wives) dispose of themselves in a (just and) honorable manner (i.e., they can marry). And Allah is well-acquainted with what you do.)