UPDATE Technically everyone "became Jewish" at the revelation at Sinai which is regarded as everyone there having converted at that moment. This is the starting point of the recursive definition of "Who is a Jew".
Technically, Judaism did not begin until the revelation at Sinai. Thus, Adam, Avraham, Yitzchak, and Yaakov were able to keep shabbat. However, we see (for example) that Torah Before Mount Sinai discusses how the Torah was kept before the revelation at Har Sinai.
Mishnah Kiddushin 82a, Yoma 28b says that Avraham kept all the Torah he even kept future Rabbinic laws too. He knew the Torah because he had ruach hakodesh (Ramban Bereshit 26.5).
Rashi Bereshit 26.5: The Avot kept the entire Torah - even the Oral Law and later Rabbinic prohibitions.
In any case, the restriction of non-Jews from keeping Shabbat was only instituted when Shabbat became a bris (covenant) with the Bnai Yisrael (at Sinai). Once that occurred, then it became forbidden for those who were not part of that covenant.
For example: Why Can’t a Non-Jew Keep Shabbat? points out that Shabbat is a bris kadosh (holy covenant) in the same way as a bris milah and implies the same level of commitment.
I have been asked in the past – Why can’t a Non-Jew keep Shabbat?
The answer to that question is quite simple, but difficult for some to
Shabbat is called a Bris Kodesh ‘a holy covenant’, just like Brit
Mila (Circumcision) is a holy covenant, so too is Shabbat.
But what is a ‘holy covenant’?
Kedusha ‘Holiness’ according to Judaism isn’t separating oneself from
this world, rather, it is using this world in order to elevate ones
soul and reach great spiritual heights. The Torah is the guidebook of
how to reach the greatest spiritual heights possible.
Since Shabbat is one of the commandments that gives us a great
spiritual lift, one can only truly benefit from the spiritual aspect
of Shabbat if he is keeping all of the other commandments to the best
of his ability – family purity, only eating Kosher, praying 3 times a
day in synagogue, and is committed to learning Torah in depth whenever
he is able to, along with all of the other commandments.
A Non-Jew that wants to keep Shabbat clearly wants to also benefit
from that connection with the creator, but that level of connection
needs to come as part of a complete package.