That was certainly not the regular case. Troops must carry provisions themselves and organize a steady supply. "Cultivation" on campaign would have been a distraction that added insecurity and required too much time and effort.
Such supply almost always must have come mainly 'from home'.
Plundering the countryside in enemy territory was always an option. But only to a limited extent. Looting a granary or other storage facility is a nice option.
'Looting' a field of crops is not so much. That's called a harvest.
The first option let's one take lots of booty in full armour quickly, the latter is a tedious and lengthy process, hindered by any type of military equipment, dispersing the soldiers in a vulnerable and exhaustive state. This means the option is rather quite self-limiting. Now imagine the added time required for waiting for the corn to sprout and grow, all the while the calories you brought with you are underground in the fields and used by the plants to their own ends, not available to your troops.
Thus, security and time would be the main obstacles making such an idea quite foolish to calculate on. On the other hand, if anyone could be sure to have both factors accounted for, converting edible seeds intended for immediate/direct human consumption into growing plants requires basically a mere decision to "just sow it".
The provision of what an army requires—food, drink, clothing, transport, camp gear, arms, armour, fodder and so on. Food and drink were the main necessity, with the need for fresh supplies. Well-organised supply was always a major factor in war. Supply for distant campaigns could be particularly difficult, requiring careful planning. When supply is insufficient, problems follow—desertion, atrocities, damage from foraging to compensate for failed supply, even death. Good supply is often the province of government and requires good communication with the army, with information on its changing needs. Medieval armies realised the need for good supply. Carolingian capitularies reserved two-thirds of grazing in some regions for the army and arranged for carts to transport supplies. Improvement came with the streamlining of taxation and bureaucracy. Ability in this area explains the military success of some rulers who may not have been great generals—Philip Augustus springs to mind. It was important to disrupt the enemy’s supply, hence the emphasis on crop destruction, pollution of water sources, attacks on supply trains, and breaking lines of communication—destroying bridges, blocking roads and ports or barring river traffic. In England from about 1300 the development of prise (the compulsory purchase of food for armies, later called purveyance) was a move towards larger-scale organisation. Protection and storage mattered. On crusade in Cyprus, St Louis collected heaps of wheat and barley as large as hills. The corn on top sprouted after rain and was wasted but that underneath remained useable.
— Jim Bradbury: "The Routledge Companion to Medieval Warfare",
Routledge: London, New York, 2004.
That means two main sources of supply for Medieval troops in Europe:
- bring it along from home (-lands) and re-supply from there
- gather supplies along the way
The 'living off the land' under 2): a model of an imagined 'dark-age' style of warfare with ample and dominant plundering in a bellum se ipsum alet mode is one very small aspect of this part of logistics.
The previous Roman method of ordering soldiers to plow fields and sow grains is also already indicative of the specific situation when to even entertain the idea of doing so:
One important source of supply for the limitanei consisted of the lands that were assigned directly to the military unit, often denoted as the fields of the legion (prata legionis). In some cases, these lands were farmed directly by the soldiers, and in others the land was leased out to civilians. In addition to these corporately held lands, over the course of the fourth and fifth centuries […] many limitanei also drew supplies from lands that were granted to them directly by the government and that were specifically intended to support their military service.
Namely that a commander must be quite sure that the lands controlled are firmly 'his'. Meaning that a borderland situation is the utmost location for such an endeavour. Such a strategy of using soldiers as actual farm hands forbids itself when attacking an opponent within the opponent's or any other 'hostile' territory.
Sowing grains takes away from your immediate food supply during your campaign for one growing season, takes time and effort itself, as does tending the fields and especially then harvesting it again.
It only makes sense if one has secured the land strategically, not just tactically. Or at least one is very confident to maintain such a position. We call that "conquered territory".
Illustrative for these constraints is the campaign of Henry against the Hungarians:
Henry III divided his army into two columns for the invasion. One, under the command of the duke of Bavaria, travelled along the Danube. The other column under King Henry’s personal command marched through Carinthia, likely along the Drava river. The German king organized a formidable logistical operation that would permit him to sustain a significant and lengthy military campaign. Notably, each of the columns of his army was accompanied by a fleet of ships to carry supplies. The two columns also were accompanied by large numbers of pack animals, which served to transport supplies from the ships to Henry’s troops as they departed from the river valleys in order to inflict the maximum possible damage on the Hungarians. However, King Henry permitted the campaign to drag on much longer than he had anticipated because the Hungarians refused to face either of the two German columns in battle, and simply withdrew deeper into the interior rather than fight.
As Henry’s forces advanced and sought to force the Hungarians to meet them in battle, the Germans ravaged the countryside, plundering as they went. However, as the contemporary German chronicler, Hermann of Reichenau (died 1054), observed, eventually King Henry’s two columns began to exhaust the supplies that they had brought with them by ship. Despite the withdrawal of Hungarian military forces from their immediate vicinity, the German troops were unable to take advantage of the fact they were operating in rich agricultural lands during harvest season. The threat posed by the Hungarian army in the field was simply too great to permit the division and dispersal of the German army over a wide enough area to forage for supplies or to harvest the available grain and prepare it to be eaten. In short, Hungarians succeeded in lengthening the campaign enough so that a lack of provisions compelled King Henry to withdraw his army without achieving a significant victory in the field. It is clear that Henry III’s army could not live off the land on a regular basis.
It seems even more clear that under such campaign prerequisites the idea of converting soldiers back to farmers is even more out of the picture.
All men and animals need to eat if they are to survive. The very fact that soldiers, their mounts, and their beasts of burden functioned effectively on campaign is irrefutable evidence that they had adequate supply from one or another source. While it is certainly true that humans can survive without food for rather extended periods without dying, this does not mean that they have the capacity to march long distances with heavy packs and undertake all of the other aspects of campaign life without adequate caloric support. Physiologically, horses are much more fragile than humans, and the failure to provide them with an adequate supply of food and water leads quickly to their breakdown and death.
The governments that mobilized fighting men for military service were well aware of the logistical needs of their troops, and put in place systems for the purpose of ensuring their supply needs. These systems varied considerably, and were based on a wide range of factors, including the wealth and sophistication of the governmental polity, the types of troops that were mobilized for service, and the duration of the campaign. When considered over the long-term, it is clear that the transition from the standing army of the Roman period to largely militia-based armies that dominated during the Middle Ages shifted much of the burden of acquiring and transporting supply from the government to the individual soldier or his immediate employer. Nevertheless, many medieval governments continued to play an active role in the logistical operations of the army, particularly for long campaigns, by prepositioning large quantities of supplies along the main routes that were to be taken by the army and along the frontiers, and by mobilizing transportation assets to carry additional supplies into enemy territory. Moreover, medieval rulers and the commanders of armies also routinely sought to organize markets along their line of march in order to facilitate the purchase of food and other necessities. This aspect of supply was particularly crucial during the crusades, when the armies of armed pilgrims were operating in the friendly territory of the Byzantine Empire, but otherwise had no claim to logistical support. By contrast with these governmentally organized sources of supply, plunder and ‘living off the land’ played a very small role in the logistical operations of armies, particularly for large armies over lengthy periods of time.
The planning for the logistical needs of armies that were to go on campaign, and the execution of these plans required a highly trained and well organized cadre of governmental officials, and sophisticated administrative systems. The vast quantity of ‘paper work’ that was necessary to move a barrel of wine or a bushel of grain to soldiers in the field is illuminated, for example, by the hundreds of thousands of surviving government documents relating to the campaigns of Edward I in Scotland between 1296–1307, or the English siege of Calais in 1346. As a consequence, the large scale of administration required to organize these military operations is unquestioned. By contrast, some scholars, who hold a ‘dark age’ view of Europe in the pre-crusade period, suggest that similar logistical operations ‘simply happened’ when a ruler mobilized an army. It is quite clear, however, that the same kinds of information had to be developed and placed in the right hands to organize the procurement and transportation of food for 30,000 men during Charlemagne’s invasion of Italy in 773 as was necessary for Edward I’s invasion of Scotland in 1298. Consequently, a proper understanding of logistics helps to illuminate the sophistication of governmental operations throughout the medieval millennium in a manner that might otherwise be missed by scholars not focused on the ‘nuts and bolts’ of the conduct of war.
— Bernard S. Bachrach & David S. Bachrach: "Warfare In Medieval Europe C.400–c.1453", Routledeg: London, New York, 2017.
To evaluate the "Arab sources" bringing 'grain to sow' during the siege in 717 as mentioned in question:
that may even be true, provided the territory firmly under their control was really confidently expected to remain in that state for a very long time
but such accounts from that time tend to be not overly reliable, using statements like the one we read also as a tool of propaganda to emphasize how much supply they had piled up, how long-term their strategic outlook was, in short, 'what great and noble leaders' these troops had — even if the explanation is purely post-hoc, and if true materially, at best nothing more than: 'food supply was so plentiful, they didn't eat it all, but then went on and used the remainder to re-sow previously devastated fields'