The play is set in the city of Messina on the Island of Sicily. Sicily belonged to the Crown of Aragon, a Spanish dynasty that was the most powerful in the 14th and 15th centuries. The Crown of Aragon was abolished as late as 1716 after the War of Spanish Succession (1702-1713).
The wars mentioned in the play most likely refer to the Spanish Wars, which was a challenge between Spain and France for parts of Italy. The wars started in 1494 due to France's invasion of Italy and finally ended in 1559 when Philip II, King of Aragon, gained complete domination of the Two Sicilies, including Messina, and Milan. We do not know which war of the Spanish Wars the play is referring to; however, the play could most likely be referring to the final campaigns of the wars that secured Sicily under the Crown of Aragon, such as the battle of St. Quentin in which Spain defeated the French in 1557, or any of the final two battles in 1558 that led to the Treaty of Cateau-Camresis in 1559.
Hence, we know that the play is set in Messina under the rule of the Spanish dynasty, the Crown of Aragon, and refers to the Spanish Wars. However, we don't know the exact years in which the play is set. Nevertheless, since Prince Don Pedro and his company have just returned from a very successful war with very few causalities, we can assume that the play may be referring to the later more successful battles. We learn in the first scene that the war was successful and that very few men died when the messenger declares, "But few of any sort, and none of name," after being asked how many men have been lost (I.i.5-6). Thus, we may be able to assume that the time period in which the play is set is the last three successful battles beginning in 1557 and culminating in complete Spanish rule over Sicily in 1559.