Note that in Medieval and Renaissance times, "adoption" wasn't what it is today.
Broadly speaking, a noble could have any number of fosterlings or wards. Making sure the niece is cared for is easy.
Whether that child could be named heir to that noble line, which is closer to our modern idea of "adoption" - making the niece legally a child of the King, is another matter entirely, based solely on the laws of succession in the particular place. There is no general answer to that. Even if technically legal, suddenly putting a commoner in line for the throne would typically be... somewhere between controversial to grounds for a civil war, depending on the details of the political situation.
It also may not be good for the girl - because if she's made heir, every noble family with a bachelor son would be seeking to marry the girl into their family, so their son would be king...