Matthew 1 only mentions women who are "famous" in the Bible, such as Ruth and Tamar. We know who they are because of who they are related to. But with Rahab, we see that she married Salmon. There is no story about him, he is only mentioned in genealogies (Ruth 4:20-21; 1 Chronicles 2:11; Matthew 1:4-5; Luke 3:32). The only significance we see he has is that he is an ancestor King David, and thus Jesus the Messiah.
It is commonly believed that Rachab in Matthew 1 is the harlot from Joshua 2. I decided to look at the Hebrew and Greek behind their names and this is what I have found. In the Greek, there are two Hebrew words that are translated as Rahab. These are the definitions according to Strong's Dictionary of Greek words in the Bible:
G4477. Rhachab
Strong's Concordance
Rhachab: Rachab.
Original Word: Ῥαχάβ, ἡ
Part of Speech: Proper Noun, Indeclinable
Transliteration: Rhachab
Phonetic Spelling: (hrakh-ab')
Short Definition: Rahab
Definition: Rahab, a Canaanitess, who rescued the Hebrew spies at Jericho.
Occurrences: Matthew 1:5
G4460. Rhaab
Strong's Concordance
Rhaab: Rahab, a Canaanitess and an ancestor of Christ
Original Word: Ῥαάβ, ἡ
Part of Speech: Proper Noun, Indeclinable
Transliteration: Rhaab
Phonetic Spelling: (hrah-ab')
Short Definition: Rahab
Definition: Rahab, a Canaanitess, who rescued the Hebrew spies at Jericho.
Occurrences: Hebrews 11:31; James 2:25
Rhachab is the Greek word used in Matthew 1. Rhaab is used to in reference specifically to the Rahab of Joshua 1, as we can see from the context of its use in the verses. Now check out the Hebrew definition of Rahab as used in Joshua:
H7343. Rachab
Strong's Concordance
Rachab: a harlot in Jericho
Original Word: רָחָב
Part of Speech: Proper Name Feminine
Transliteration: Rachab
Phonetic Spelling: (raw-khawb')
Short Definition: Rahab
Occurences: Joshua 2:1, Joshua 2:3, Joshua 6:17, Joshua 6:25
I find it interesting that the Greek Rhachab is similar in pronunciation to the Hebrew Rachab. This could support the identification of Rhachab as the harlot being accurate.
I don't know whether or not Salmon was a contemporary of Rahab, but if the above evidence is enough evidence to support Rhachab being Rachab the harlot, then Salmon would have to be a contemporary of Rahab. As far as I can tell, it looks like he would be, but without dates to work with, I cannot say with certainty. But I will give you the best I have.
If Aram did flee Egypt in the Exodus as an adult, Amminadab could very well have been a child (say about 10 years old) at the time. Let's say he was about 20 years old when he had Nahshon. And Nahshon was also about 20 when he had Salmon. Salmon would have been about 10 years old at the end of the 40 years, thus he could have been a contemporary. Let's look at one extreme. Say each of these people had their kids when they were about 15. This would put Salmon at 20 years old.
So it is possible that he was old enough to marry Rahab. The Bible doesn't say when he married Rahab, but is does say Rahab lived with the Israelites and was living among them at the time of the writing of Joshua. So she could have lived among the Israelites for a while, making friends and settling in. Eventually she would have met Salmon, and in due time they got married. Who knows how long it took for these events to happen.
Considering the above evidence, although it is not the best by my own standards, I personally am convinced that the Rahab of Matthew 1 is the same Rahab of Joshua 2. By the way, I am curious as of why there are two Greek words for Rahab and hope to find some answer, although there very well might not be one until we learn of it in heaven.
*The definitions above are supplied by Bible Hub