An idea for a possible wife:
Elisabeth, elder surviving daughter of Willem Adriaan van Nassau, lord of Odijk. Her father was a personal friend of Charles II; her grandfather was Dutch ambassador to England; her aunts were the duchess of Grafton and countess of Arlington; and her great-grandfather was Maurits, Prince of Orange (via an illegitimate line).
Otherwise, after the duke of Gloucester's death in 1700 its going to be excruciatingly clear how close Frederick is to the throne. If he's not already married, Anne and her associates will probably arrange a marriage for him at that time, to cut off the Catholic heirs to the throne. Anne's husband, Prince George, had a 23-year-old niece, Sophie of Denmark, who's a possible choice to bring in for Frederick. By 1700, Sophia Hedwig had three failed bethrothals (OTL she would never marry) and was officially entering old maidhood, but was staunchly Protestant and absolutely royal. Under ordinary circumstances marrying her to Frederick would be something of a mesalliance, but he's almost guaranteed to be the future king of Britain. Possibly they could be given a dukedom, such as that of Cambridge (most recently held by one of the deceased sons of James II and Mary of Modena).
Possible TL:
1700: Death of the duke of Gloucester.
1701: Frederick Rakoczi marries Sophie, sister of Frederick IV of Denmark. They are created duke and duchess of Cambridge. Parliament passes the Act of Settlement, declaring that, failing the issue of Anne or William III by a future marriage, that the throne shall go to the duke of Cambridge, his legitimate Protestant issue, and then to Sophia, electress of Hannover, and her legitimate Protestant issue.
1702: Anne becomes queen in March. In December, the duke and duchess of Cambridge welcome a son, Charles Frederick.
1704: The duke and duchess of Cambridge welcome a daughter, Anne Henriette (called Annette).
1705: The duke and duchess of Cambridge welcome a second son, Rupert Christian.
1708: In March, James Stuart, half-brother of Queen Anne, attempts to land in Scotland but is driven away. In October, Prince George of Denmark, Anne's husband, dies.
1709: The duke and duchess of Cambridge welcome a third son, George Sigismund.
1714: Queen Anne dies in August. Frederick Rakoczi, duke of Cambridge, is proclaimed king and he and Sophie are crowned without incident. His eldest son, 11-year-old Charles Frederick, is Prince of Wales; his daughter Annette, aged 9, becomes Princess Royal; his second son, Rupert, aged 8, becomes duke of York; and his third son, George, aged 5, becomes duke of Gloucester.