When she married Harry. Women assume titles and styles of their husbands. Harry is a royal Prince of the United Kingdom, Duke of Sussex, Earl of Dumbarton, and Baron Kilkeel. His wife assumes that status. Meghan is HRH, the Duchess of Sussex, Countess of Dumbarton, Baroness Kilkeel, the Princess Harry,(or more formally, Henry). Women who assume royal status through marriage are royal through marriage which means that whenever the title of Princess is used, it is the husband's name that follows that particular title; only a female born or bestowed a princess in her own right uses the title of Princess with her own given name. And, in the British royal family, Harry is an official working royal, so Meghan is expected to take on that occupation.
The former Catherine Middleton, the former Sophie Rhys-Jones, the former Sarah Ferguson, and the late Diana, Princess of Wales all took on the status and official working royal occupations of their royal husbands.