Great question! The major problem for historians attempting to reconstruct the early origins of Islam is the lack of source material. The short answer is that both the Eastern Roman and Persian imperial governments probably were not aware of Muhammad's preaching or the formation of the umma in any serious capacity beyond basic rumour and hearsay. Even if they were, is it evident that no serious defensive measures were undertaken.
Source Material
Frustratingly, given their historical significance, both Muhammad and early Islam simply don't have much contemporary documentary evidence that would give us the necessary information for a definite answer. This answer will focus almost entirely on sources outside of Persia... because there basically aren't any Persian sources at all. The first reliable mention we have of a Prophet amongst the Arabs is found in the Doctrina Jacobi, written c.637:
"My brother Abraham has written to me from Caesarea that a false prophet has appeared among the Saracens ... And they say that a prophet has appeared coming up with the Saracens and proclaims the coming of the anointed, the Christ who cometh".^[1]
By 640 we have more mention in Syriac sources, but the most detailed (relatively) contemporary account comes from the Armenian History attributed to the Archbishop Sebeos, c.560:
"They gathered in unison 'from Ewila as far as Sur, which is opposite of Egypt' ... All the remnants of the people of the sons of Israel gathered and united together; they formed a large army".^[2]
The lack of Eastern Roman source material is problematic. We can't know for sure, but it appears that given the astounding lack of detail provided by these sources, people in the Eastern Roman Empire may not have known what was going on in Arabia in the 620s. The majority of evidence we have for this formative period of Islam, of course, comes from the Islamic tradition. But historiography in the last few decades has become increasingly sceptical of this. Handed down through oral tradition, much of it was only written down proper in the ninth century. Many historians, most prominently Patricia Crone and Michael Cook in their book Hagarism^[3], have expressed serious doubts with the value and reliability of evidence from Islamic sources. It is now widely accepted that their criticisms go too far, but even if the broad outline of the Arabic historical tradition can be said to be reasonably reliable, Crone and Cook have given some justifiable arguments for acknowledging that its finer details must be treated with serious caution.^[4] This is a super interesting historiographical debate which I am happy to expand upon more, but in direct response to your question, there is little that I know of in Islamic sources that deals with the views of the Romans/Persians at all.
Superpower Conflict
There is, however, a very good contextual reason for the lack of external knowledge about dynamics in Arabia in the 620s: Both Rome and Persia were locked in a massive struggle for power at the time. As Muhammad's preaching went on, Heraclius was literally fighting for the Eastern Roman Empire's survival.The Eastern Roman Empire was thrown into chaos by the Phocas' coup of 602, and Khusro II took the opportunity to attack his vulnerably "ally". Syria was captured by 610; Palestine by 614; and Anatolia up to the walls of Constantinople by 626. The overwhelming military and diplomatic focus of Heraclius' ultimately successful counterattacking campaigns were centred on the Roman-Persian frontier in Mesopotamia and the Transcaucasus (necessarily supported by the steppe Turks). The Persian empire swiftly collapsed following this dramatic counterattack, and descended into civil war.
This isn't to deny that Arabia formed an important part of the diplomatic activity of the two empires; since the age of Justin I we see both empires focusing more on their respective client rulers along the northern fringe of Arabia, and a simultaneous struggle for control over Yemen in the south. And it's very clear that there were obvious lines of communication between Arabian tribes and the Eastern Roman empire - not just through trade, but the migration of peoples, historic diplomatic activity, migration caused by war - all these are well evidenced by the external religious/intellectual thoughts appropriated and remoulded by Islam. But Arabia was simply not the main focus of the struggle between the two empires, and so Heraclius and Khusro II were very likely distracted from dynamics in Arabia by their protracted struggle elsewhere on the frontier. This is especially the case for the Persians, who were thrown into total political and administrative chaos following Heraclius' campaign of 628.
The Initial Conquests
So, how about during the very early conquests? Muhammad's early campaign northward took him into Byzantine-held provinces in Arabia, and there is evidence of resistance to this advance. But this defence was led by pro-Eastern Roman Arab tribes, and there is no reason to believe that the Eastern Romans took any measures here directly. The various peace agreements that Muhammad concluded with settlements in the northern Arabian Peninsula vary considerably, which heavily suggests that there was no centralised negotiation led by an Eastern Roman official.^[5] Anyway, Arab raids really were not new. Chronicle evidence from a monk of the Mar Saba monastery makes clear that a series of raids occurred led by Arabs in the 610s, for example. So early raids by Muhammad's followers wouldn't have caused any serious shock at this point.
The earliest reliable evidence we have about a serious Eastern Roman response to Arabian armies dates a conflict to 634, when "on Friday 4th February ... a Byzantine force engaged the Arabs of Muhammad in Palestine".^[6] The tide then turned, as we know, unbelievably quickly against the Eastern Romans. But before this we really do not have any evidence of concerted defensive measures taken by the Eastern Romans. In fact, the rapidity of invasion undertaken by Islamic forces suggests that the Romans were entirely underprepared for confronting the Arab tribes. Restoration of imperial rule over Syria/Palestine/Egypt in the wake of the Persian withdrawal occurred from 628-630, but this was most likely symbolic, and direct Roman control was yet to be fully restored. So we can't expect many official defensive measures from the Eastern Roman government against the Arabian threat. Rather, many of the alleged "armies" that the Arabs encountered in their early assaults were likely simply local levies scraped together by local rulers to defend themselves against. Historically, the Eastern Romans had a very light defensive policy on their desert frontier. It wasn't possible to wall off, lines of fortresses along the length of the frontier were too expensive, and the "border" was much too porous anyway.
Summary
So there is no reason to believe that there were any serious preemptive measures undertaken against the Arab threat, for which we have minimal information to suggest that the Eastern Roman and Persian governments were aware of anyway. The most contemporary sources we have really don't go into much detail on political currents in Arabia, which is hardly surprising; the vast majority of testimony has not survived, after all. But the vagueness of the sources we do have might suggest that little was known outside of Arabia itself. Yet the most convincing evidence is the context in which this formative period of Islam occurred; the protracted superpower conflict from 602 onwards, which in the 620s was overwhelmingly focused in Mesopotamia and northwards, meant that both the Roman and Persian empires had little reason to concentrate on internal dynamics within Arabia. This also gives a solid reason to believe that both powers did not take serious pre-emptive measures against the rising threat; they were simply distracted by more immediate considerations. Evidence we have from the earliest conquests suggests that there was no serious Eastern Roman response until the Arabian armies were already invading their territory, so this can definitely not be considered pre-emptive.
Hope that helps - I'm happy to clarify or expand on anything above, and I can go into more detail on the historiographical debate on the available source material if needed.
Footnotes:
Sources and further reading:
Historiographical debate on source material: