Everyone is different so the amount of time you’ll need to prepare will depend on your specific circumstances and knowledge.
Having said that, we’ve helped thousands of candidates get ready for the QLTS (the old exam for foreign lawyers on which the SQE is based) for over a decade, plus thousands more since the SQE came into force, so we know roughly how long the average student will need to prepare:
Give yourself 9-12 months to prepare for both SQE1 and SQE2.
Study for 15-20 hours a week for 5-6 months for SQE1.
Study for 15-20 hours per week for 3-4 months for SQE2.
You don’t have to follow this exactly. You could study for fewer hours each week but for a longer amount of time, or vice versa. But be prepared for a few months of hard work in the run-up to your assessments.