The words pray, prey sound the same but have different meanings and spellings. Why do pray, prey sound the same even though they are completely different words?
The answer is simple: pray, prey are homophones of the English language.
To utter or address a prayer or prayers to God, a god, or another object of worship.
To make a fervent request or entreaty.
To utter or say a prayer or prayers to; address by prayer.
To ask (someone) imploringly; beseech. Now often used elliptically for I pray you to introduce a request or entreaty: Pray be careful.
An animal hunted or caught for food; quarry.
One that is defenseless, especially in the face of attack; a victim.
The act or practice of preying.
To hunt, catch, or eat as prey: Owls prey on mice.
Definitions from The American Heritage® Dictionary of the English Language, 4th Edition and Wordnik.
Homophones (literally "same sound") are usually defined as words that share the same pronunciation, regardless of how they are spelled.
If they are spelled the same then they are also homographs (and homonyms); if they are spelled differently then they are also heterographs (literally "different writing").