The answer, even using more than one SQL statement, was much harder than I thought it would be.
The easy answer to your question is: create a table with all sibling relationships. Then you can just query this as:
select siblingid
from @allsiblings sa
where sa.userid = 3
One note. I'm using the syntax of SQL Server, just because that happens to be the most handy database. I'm only using functionality in MySQL so it should be easy to translate.
How to create the table @AllSiblings? Well, just keep on adding sibling pairs in that don't exist, until there are no more to add. We get the pairs by doing a self join.
Here is the code (subject to the previous caveat):
declare @allsiblings table (userid integer, siblingid integer);
declare @siblings table (userId int, siblingID int);
-- Initialize the @siblings table
insert into @siblings(userId, siblingID)
select 1 as userID, 2 as siblingID union all
select 1 as userID, 3 as siblingID union all
select 6 as userID, 5 as siblingID union all
select 5 as userID, 3 as siblingID union all
select 3 as userID, 1 as siblingID union all
select 4 as userID, 6 as siblingID;
-- Initialize all siblings. Note that both pairs are going in here
insert into @allsiblings(userid, siblingid)
select userId, siblingid from @siblings union
select siblingID, userid from @siblings
-- select * from @allsiblings
while (1=1)
begin
-- Add in new siblings, that don't exist by doing a self-join to traverse the links
insert into @allsiblings
select distinct sa.userid, sa2.siblingid
from @allsiblings sa join
@allsiblings sa2
on sa.siblingid = sa2.userid
where not exists (select * from @allsiblings sa3 where sa3.userid = sa.userid and sa3.siblingid = sa2.siblingid)
-- If nothing was added, we are done
if (@@ROWCOUNT = 0) break;
select * from @allsiblings;
end;