As long as a driver holds an FIA super licence he is free to race in F1 as long as he partakes in at least 1 practice session before qualifying
As I said, a contract would be an agreement between a team & a driver, the terms of which has nothing to do with the FIA or F1
For example Lewis and Merc could verbally agree at 8.59am on Saturday morning that he will drive the car for that weekend only, for X amount of money, shake on it, and off he’d go at 9am in FP3
The Hulk didn’t have a pre-existing contract with RP when he filled in for Perez last year