How can the Muslim intend his whole life to be for Allah?
Question

                I am having a hard time understanding something. We are supposed to do everything for Allah alone. So if I want to lose weight or anything else, if I do it to look better, is this the wrong intention? If it is wrong, then what is the correct intention that I should form if I want to do something like that? When people say, you should get married for the sake of Allah only, and you should do anything else for the sake of Allah only, what does that mean in practical terms?
Praise be to Allah.The Muslim is the one who submits to Allah, may He be glorified and exalted, and complies with His laws and His commands and prohibitions, who worships Allah, may He be exalted, because He is his Lord and Creator, Who is deserving of worship; he believes in the existence and greatness of Allah and that He is Self-Sustaining and the Sustainer of the universe. Thus belief in Allah will fill his heart and control his thoughts; love of Allah will become his goal in this life and the next, and he will hope that Allah will accept him among His righteous slaves.
Allah, may He be exalted, says (interpretation of the meaning):
“Say, ‘Indeed, my Lord has guided me to a straight path - a correct religion - the way of Abraham, inclining toward truth. And he was not among those who associated others with Allah.’
Say, "Indeed, my prayer, my rites of sacrifice, my living and my dying are for Allah , Lord of the worlds.
No partner has He. And this I have been commanded, and I am the first [among you] of the Muslims”
[al-An‘aam 6:161-163].
The one who understands these meanings will strive to keep in mind the intention of drawing closer to Allah, may He be glorified and exalted, in all aspects of his life. So when he sleeps, he seeks reward for his sleep with Allah, may He be glorified and exalted, because by sleeping and resting he will have the energy to worship Allah when he wakes up. When he eats or drinks, he intends thereby to have nourishment that will help him to fulfil his duty towards Allah. When he gets married, he aims to keep himself chaste and to be content with what is lawful so that he has no need of what is unlawful. When he seeks to have children, he seeks to have righteous offspring who will increase the number of those who adhere to the path of Allah. When he speaks, he speaks for a good reason, and when he remains silent, he does so to avoid saying anything bad. He seeks reward by spending on himself and his family. When he learns, reads and studies, he seeks reward for that too. Such are his intentions and aims in all his deeds.
Ibn Taymiyah (may Allah have mercy on him) said: He should not do permissible deeds except that which will help him to obey and worship Allah, and his intention in doing these permissible deeds should be to gain energy to obey and worship Allah. End quote.
Majmoo‘ al-Fataawa (10/460-461).
In brief, this is how the Muslim can intend his entire life and all his deeds to be for the sake of Allah, and we can sum that up in the following two points:

He should adhere to Islamic teachings in his deeds, so he should not fail to do any obligatory duty and he should not commit any infractions.
He should note in his heart how he can connect this action – even if it is basically a worldly matter – to reward and seeking to draw closer to Allah, may He be exalted.

You can apply this to your specific question about losing weight. Whoever wants to make efforts to lose weight in order to maintain good health so that he can perform obligatory deeds and do his duty towards Allah in a better manner, or wants to make himself look good for his wife, so as to achieve happiness and love between them, or wants to look better for people so that he will be better accepted among them, and have a better relationship with them, these are all good aims and one will be rewarded for that, in sha Allah.
But if this permissible action is done with the intention of imitating some of the disbelievers, or is done to make one attractive to girls, and other devilish aims, then this is sinful and deserving of punishment.
The same applies to all permissible matters; the one who does them will not be rewarded unless he seeks reward thereby and is aiming to achieve a good purpose.
Ibn al-Haajj (may Allah have mercy on him) said: Depending on intention, a permissible deed may become recommended (mandoob). End quote.
Al-Madkhil (1/21).
Ibn al-Qayyim stated that the elite among those who are close to Allah are those for whom permissible acts have become acts of worships and means of drawing closer to Allah because of the intention behind them. In their case, permissible deeds bring them closer to Allah. End quote.
Madaarij as-Saalikeen (1/107)
It is soundly narrated from the Messenger (blessings and peace of Allah be upon him) that he said to Sa‘d ibn Abi Waqqaas (may Allah be pleased with him): “You will never spend on maintenance, seeking thereby the Countenance of Allah, but you will be rewarded for it, even a morsel that you put in your wife’s mouth.” Narrated by al-Bukhaari (56) and Muslim (1628).
Imam an-Nawawi (may Allah have mercy on him) said, commenting on this hadith:
This indicates that if a permissible thing is done with the intention of seeking the pleasure of Allah, may He be exalted, it becomes an act of obedience and worship, and he will be rewarded for it. The Prophet (blessings and peace of Allah be upon him) highlighted this when he said, “even a morsel that you put in your wife’s mouth,” because man finds pleasure with his wife and enjoys permissible intimacy with her, and when he puts a morsel of food in her mouth, that is usually a kind of playful and kind treatment, and enjoying that which is permissible, which is something that is far removed from acts of worship and matters of the hereafter, yet despite that, the Prophet (blessings and peace of Allah be upon him) said that if he seeks the pleasure of Allah, may He be exalted, by doing that, he will be rewarded for it. So other matters are more likely to be deserving of reward, if he seeks to please Allah, may He be exalted, by doing them.
That also applies if a person does something that is basically permissible, and seeks to please Allah, may He be exalted by doing it; he will be rewarded for that. This is like eating with the intention of strengthening oneself to do acts of obedience to Allah, may He be exalted, and sleeping in order to rest so that he can get up and do acts of worship with energy, and enjoying intimacy with his wife so that he can restrain himself and his gaze and so on from unlawful things, and so that he can fulfil his wife’s rights, and produce a righteous child. This is the meaning of the words of the Prophet (blessings and peace of Allah be upon him), “And in the intimacy of one of you [with his wife] there is sadaqah [charity].” And Allah knows best. End quote.
Sharh Muslim (11/77).
As-Suyooti (may Allah have mercy on him) said:
One of the best proofs that a person will attain reward by having a sound intention when doing permissible things and customary practices is the words of the Prophet (blessings and peace of Allah be upon him): “And each person will have what he intended.” The one who does this will be rewarded, if he seeks thereby to draw closer to Allah, but if he does not seek or intend that, then he will have no reward. End quote.
Sharh as-Suyooti ‘ala an-Nasaa’i (1/19).
And there are many similar comments from the scholars concerning this matter.
See also the answer to question no. 69960.
But you should understand that what we have mentioned to you about the intention of growing closer to Allah, may He be exalted, by means of what you do of permissible things is not by way of obligation and compulsion, because if it were obligatory and compulsory, it would not be permissible; rather it would be obligatory, and a person would be sinning by not doing it.
As for the one who does not intend anything except to fulfil his personal wishes, or desire, or need, or to enjoy something that is permissible, there is no blame on him for what he does, so long as he knows that this matter is something that sharee‘ah has allowed and permitted. But he will not be rewarded merely for doing that deed, just as there is no sin on him for simply doing it.
And Allah knows best.