- In medieval times:
- If a Queen dies and she previously has a child with the King, and that King remarries and has a child with his new queen, then is his first child claimed illegitimate so that the second may claim the throne?
No. The mother of the child does not matter, just the order of their birth. Therefore, given that both children were sons, the son of the deceased Queen would be first in the succession line, followed by the sons from the second Queen.
You may have been influenced by the example of Henry VIII and his first wife Catherine of Aragon. However, their wedding was annulled due to "incest", since she was previously married to his brother.
- Also, if his second wife already has a child, then what is the ranking of that child? Could it have a claim to the throne?
The children could only receive titles by their biological father. Therefore, the child from a previous marriage would bare the titles of his/her father, and not his/her royal stepfather. That means that it would not have any claims to the throne. However, the King may chose to grand a title, at the request of his new wife.
A some-how related example is that of Isabella of Angouleme, wife of King John of England. After she gave birth to a son, John died and she re-married. She had a lot of children with her second husband and those were given titles and fortunes by their half-brother, that had inherited the throne. However, they were not in line to the throne.